5.4.2. Traditional for
Statement
The syntactic form of the for
statement is:
for (init-statement condition; expression) statement
The for
and the part inside the parentheses is often referred to as the for
header.
init-statement must be a declaration statement, an expression statement, or a null statement. Each of these statements ends with a semicolon, so the syntactic form can also be thought of as
for (initializer; condition; expression) statement
In general, init-statement is used to initialize or assign a starting value that is modified over the course of the loop. condition serves as the loop control. As long as condition evaluates ...
Get C++ Primer, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.