Q:

C++ while loop with 2 conditions, VS. for loop with 2 conditions?

If I wanted to iterate through a string, and stop once I found either the letter "o" or the end of the string, would it make any difference to use a while loop to check the 2 conditions, or a for loop with 2 conditions?
const int STRING_SIZE = 16;
char str[STRING_SIZE] = "a bunch of words";

for loop
for (int i = 0; i < STRING_SIZE && str[i] != 'o'; i++){
    //do something
}

while loop
int i = 0;

while (i < STRING_SIZE && str[i] != 'o'){
    //do something
    i++
}

Is there a performance difference between the two? Is one better practice than the other?

A:

There is no difference in performance between the two loops except that:
for() Checks condition then if true its body is executed. So for is simile to while loop.
do-while loop works a slightly different: It executes then checks so at least an execution is ensured.

