The for Statement
A variable such as n in the factorial function is
called a loop control variable (LCV).
Iterations that proceed by successively incrementing or decrementing LCVs can
be accomplished using a for statement.
The for statement has the form:
for (init; test; step) statement;
where:
- init is a statement that initializes a LCV
- test is an expression that tests the LCV for some value
- step is a statement that increments or decrements the
LCV, and
- statement is repeated as long as test's value
is true.
statement can be compound, but it doesn't have to be.