i = i++
is like doing:
int old_i = i;
i = i + 1;
i = old_i;
What is actually happening is that the value of i++
is the value of i
before the increment happens, then i
will get the value of.. i
.
In one line i++
will use the old value of i
and then it will increment it.