6.8.5 Iteration statements
Syntax
1 iteration-statement:
while ( expression ) statement
do statement while ( expression ) ;
for ( expression
opt ; expression
opt ;
expressionopt ) statement
for ( declaration; expression
opt ;
expressionopt ) statement
Constraints
2 The controlling expression of an iteration statement shall have scalar type.
3 The declaration part of a for statement shall only declare identifiers for objects having
storage class auto or register.
Semantics
4 An iteration statement causes a statement called the loop body to be executed repeatedly
until the controlling expression compares equal to 0. The repetition occurs regardless of
whether the loop body is entered from the iteration statement or by a jump.136)
5 An iteration statement is a block whose scope is a strict subset of the scope of its
enclosing block. The loop body is also a block whose scope is a strict subset of the scope
of the iteration statement.
136) Code jumped over is not executed. In particular, the controlling expression of a for or while
statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
Partager