Order of Evaluation in C CPP Interview Questions
1.Under my compiler, the code “int i = 7; printf(“%d\n”, i++ * i++);”
prints 49. Regardless of the order of evaluation, shouldn’t it
A:The operations implied by the postincrement and postdecrement
operators ++ and — are performed at some time after the operand’s
former values are yielded and before the end of the expression, but
not necessarily immediately after, or before other parts of the
expression are evaluated.
2.But what about the &&, ||, and comma operators?
A:There is a special exception for those operators, (as well as ?: );
left-to-right evaluation is guaranteed.