posted 24 years ago
Sounds weird, right? Even the expression,
int x =0;
x = x++;
results in assigning 0 to x;
I think we need to see how this is done step by step.
First the expression is evaluvated. In this case, we get x = 0.
Then, x is incremented; x = x + 1;
Finally the evaluvated expression is executed, so x = 0 is executed resulting in assigning 0 to x.
I hope i haven't missed anything.