For Statement

The for statement has the form

for ( expression-1opt ; expression-2opt ; expression-3opt ) statement

This statement is equivalent to

expression-1 ;
while ( expression-2 ) {
        statement
        expression-3 ;
}

Thus the first expression specifies initialization for the loop; the second specifies a test, made before each iteration, such that the loop is exited when the expression becomes false or @; the third expression often specifies an incrementation which is performed after each iteration.

Any or all of the expressions may be dropped. A missing expression-2 makes the implied while clause equivalent to

while (1);

other missing expressions are simply dropped from the expansion above.


[BACK] [FORWARD] [HOME] [UP] [HELP]