The for
statement has the form:
labelopt for ( expression-1opt; expression-2opt; expression-3opt) statementIt is equivalent to:
expression-1; while (expression-2) { statement expression-3; }in the absence of
continue
or break
statements. Thus, the first expression is an initialization, the second a test for starting and continuing the loop, and the third a re-initialization for subsequent travels around the loop.