Well, the right-hand side expression must be evaluated before the assignment can take place. Now, i++
will evaluate to the current value of i
, and i's value will subsequently increase by one. However, the assignment hasn't been performed yet, and when it is, it will overwrite the current value of i
(1) with whatever the rhs expression evaluated to, which in your case was 0.
The key difference is between ++i
(pre-increment, which evaluates to the new value of i
after incrementing) and i++
, or post-increment, which evaluates to the current value of i
before incrementing.
Had you used ++i
instead, the right-hand side expression would have evaluated to 1, resulting in i == 1.