You do not have permission to edit this page, for the following reason:
You can view and copy the source of this page.
Return to Undefined Behaviour in C.
Let's start with an example:
i = 0; x = x++;
Will this make x = 0 or x = 1?
We all know the precedence rule and what post increment does (returns the value and then increment the operand). So , lets apply that:
x = (x++);
x = 0; and x will be incremented.
But the problem starts.
In any text book you would have read till this. But when will x be incremented? Is it immediate? Is it before the next operation is done?
The increment is not done immediately. C specifies certain points before which this (these kinds of side-effects) will be completed. As normally expected all operators in C doesn't form this points (as in the case of Java) and the obvious reason is to make C code run faster. And these points are called "Sequence points" in C.