This is a question from kn king\'s c programming : a modern approach. I can\'t understand the solution given by him:-
The expression ++i is equivalent to (i
In a normal operation without assignation:
++i and i++
increase the variable in 1. In pseudo assembly both code it is:
inc i
but If you assign the value the order of ++ is relevant:
x = i++
produce:
mov x, i
inc i
x = ++i
produce:
inc i
mov x, i
In the case of: i += 1
it will produce:
add i,1
but because compilers optimize the code it also will produce in this case:
inc i