Replace a part of code with variable

I am sorry to ask such a basic question. :-( I just started using c+, so I don't know what key words to search for to find an answer. I now use this -> while((Buss1.search(addr)) { It works great!

But now I want to replace Buss1 with a variable. Preferably a array. element.

How do I do that?

 string OurBussX[1,2];

  while((OurBussX(1).search(addr)) {

Thank You! Ron Derkis

This is not the correct syntax, but you are on the right track. From your snippet we can't tell what type Buss1 is, but it is unlikely to be a string.

rderkis: I am sorry to ask such a basic question. :-( I just started using c+, so I don't know what key words to search for to find an answer. I now use this -> while((Buss1.search(addr)) { It works great!

But now I want to replace Buss1 with a variable. Preferably a array. element.

How do I do that?

 string OurBussX[1,2];

  while((OurBussX(1).search(addr)) {




Thank You!
Ron Derkis

rderkis:
I am sorry to ask such a basic question. :-(
I just started using c+, so I don't know what key words to search for to find an answer.
I now use this -> while((Buss1.search(addr)) {
It works great!

But now I want to replace Buss1 with a variable. Preferably a array. element.

How do I do that?




string OurBussX[1,2];

  while((OurBussX(1).search(addr)) {




Thank You!
Ron Derkis

You can do it, but not this way even if the syntax was fixed.

Once the code is compiled, all names are gone and replaced with memory addresses. So you can't use a string and expect the processor to recognize it as a variable or function name.

You will need to forget about the name of the thing, and get a pointer to it. That's a big step for someone new to C++, so it might be better to do some studying first.

I don't much care about complexity, all I have is time. If you are unsure of the needed code perhaps you could just give me some keywords, that I could Google, that would point me to a explanation of how to do it.

Thank You For Your Input Delta_G ! Ron Derkis

I can’t even work out the intention.

It is my fault you don't understand. I don't know the terminology. Real Question - Is Buss1 a object as used here? If so how do I replace a object with a variable or array element (and get it to compile). (

while((Buss1.search(addr)) {

Thank You! Ron Derkis

I think Buss1 is an object of some type. But you're only showing a snippet of code and the declatartion of Buss1 isn't part of what you've chosen to show.

Either post the whole code, and some sort of description of what you want to accomplish, or take your question here.