That is undefined behaviour and as such it is entirely up to the implementation of the compiler in which order the following operations are done:
- submit argument
a
- submit argument
a++
- submit argument
++a
- increment
a
for++a
- increment
a
fora++
The only thing that the compiler knows is: 2. has to happen before 5. and 4. has to happen before 3.
You are observing:
++a;
submit argument 2
a++;
submit the other arguments