...
This code always results in g
being assigned the value 2
.
Exceptions
EXP10-C-EX1: The &&
and ||
operators guarantee left-to-right evaluation; there is a sequence point after the evaluation of the first operand.
EXP10-C-EX2: The first operand of a condition expression is evaluated; there is a sequence point after its evaluation. The second operand is evaluated only if the first compares unequal to 0; the third operand is evaluated only if the first compares equal to 0.
EXP10-C-EX3: There is a sequence point before function calls, meaning that the function designator, the actual arguments, and subexpressions within the actual arguments are evaluated before the function is invoked.
EXP10-C-EX4: The left operand of a comma operator is evaluated before the right operand is evaluated. There is a sequence point in between.
...