Increment Expression Acts Like a Standalone Statement
The increment expression in the
for statement acts like a standalone statement at the end of
for statement’s body. Therefore, for integer counters, the expressions
counter = counter + 1 counter += 1 ++countercounter++
are all equivalent in the increment expression (when no other code appears there). The integer variable being incremented here does not appear in a larger expression, so both preincrementing and postincrementing actually have the same effect.
Common Programming Error 5.1
Placing a semicolon immediately to the right of the right parenthesis of a for header makes the body of ...