It is all about syntax. 6.8.5 gives two forms for loops:
for ( expressionopt ; expressionopt ; expressionopt ) statement for ( declaration expressionopt ; expressionopt ) statement
The second version refers to the case when you declare loop iterator variables new with C99.
Now, if we look at what the declaration syntax means, it is in 6.7:
declaration: declaration-specifiers init-declarator-listopt ;
Note the semicolon at the end - it requires a semicolon as part of the syntax. Copy / paste the syntax into the second version of the for loop and you will get the following:
for (declaration-specifiers init-declarator-listopt ; expressionopt ; expressionopt )
source share