According to the standard ISO/IEC 9899:2011 Information technology -- Programming languages -- C §6.8.5.3/1 The for statement (Emphasis Mine):
The statement
for ( clause-1 ; expression-2 ; expression-3 ) statement
behaves as follows: The expression expression-2 is the
controlling expression that is evaluated before each execution of the
loop body. The expression expression-3 is evaluated as a void
expression after each execution of the loop body. If clause-1 is a
declaration, the scope of any identifiers it declares is the remainder
of the declaration and the entire loop, including the other two
expressions; it is reached in the order of execution before the first
evaluation of the controlling expression. If clause-1 is an
expression, it is evaluated as a void expression before the first
evaluation of the controlling expression.137)
Therefore the increment is taking place at the end of each iteration of the for loop.
You can also see this in the following example. A for
loop most likely is materialized by the compiler like a goto
statement. Consider the following piece of code:
int main(void) {
int i;
for (i = 0; i < 5; i++) {
}
}
The assembly code produced by this code is:
main:
pushq %rbp
movq %rsp, %rbp
movl $0, -4(%rbp)
.L3:
cmpl $4, -4(%rbp)
jg .L2
addl $1, -4(%rbp)
jmp .L3
.L2:
movl $0, %eax
popq %rbp
ret
LIVE DEMO
If you focus at .L3
(i.e., the for
loop) you'll notice the statement
addl $1, -4(%rbp)
which is where the increment is taking place (i.e., ++i
). After that command there's the jump back to .L3
(i.e., next iteration).