Ways of evaluating this include...
Code:temp = i; i++; b = temp / i; i++;Code:temp = i; i++; b = i / temp; i++;Each interpretation is plausable, other interpretations are also plausable, but NONE of them are correct.Code:temp = i; b = temp / temp; i++; i++;
Read this again, and play very close attention to what it says about "after" in relation to the postfix operators.
Side effects do NOT follow operator precedence or parentheses, so no amount of
will change the way side effects are applied to the expression.Code:b=i++ + i++; b=i++ / i++; b=(i++)/(i++);
If you want a guaranteed answer, then write
The only thing you can GUARANTEE about side effects is that they will happen before the next sequence point (that's the ; in this example).Code:b = i / i ; i += 2;
Sequence points are defined here.