test condition

is the test-condition in a for statement is tested at the end of each pass? I am very confused on this topic. Thanks!
No, at the beginning of each pass. But the third section (the part where you usually put the ++ or --) is executed at the end of each pass if I am correct. (therefore, if the condition starts out false, the loop will never execute)
Yes a for loop like this:

1
2
3
for(int i = 0; i < 10; ++i) {
    //stuff
}


Is the same as:

1
2
3
4
5
6
7
{
    int i = 0;
    while(i < 10) {
        //stuff
        ++i;
    }
}
Topic archived. No new replies allowed.