The for()… statement has the following syntax:
for( counter_initialization ; continuation_expression ; counter_increment )
statement_body
The for()… statement consists of a three-part control expression and a statement body. The control expression is made up of a counter_initialization expression, a continuation_expression, and a counter_increment expression, where a semicolon separates each part of an expression. Each one has a well-defined purpose. Their positions cannot be interchanged.
Upon executing the for()… statement, the counter_initialization expression is evaluated. This is performed only once. Then, continuation_expression is evaluated. If its result is true, the statement_body is executed. At the end of statement_body, thecounter_incrementexpression is evaluated. Then, the process repeats, with the evaluation of continuation_expression. When continuation_expression evaluates to...