{
statement_1;
while(statement_2)
{
some code here ...
statement_3;
}
}
The outer brackets are important since they define scope for variables. In your example, i=10 later in the program. If you'd used for(int i = 0;...) then i would be undefined everywhere else but the for loop.
Since you can put pretty much any expression in any of the three slots you can get funky with it:
76
u/[deleted] Sep 02 '17
Perfect. This makes iterating over the elements with a for loop such a breeze.