In the call printf(“%d %d”, f(), g());, what does the C standard say about which function is called first?
Correct answer D. The order is unspecified, so either may be called first
Explanation
The evaluations of function arguments are unsequenced relative to each other, so the order is unspecified and may differ between compilers or optimisation levels. There is a sequence point before the actual call, so all arguments are complete by then. If f and g have side effects that matter, call them in separate statements and store the results first.
Answer checked How we write and check questions
Discussion