Interview Questions

Why did printf ..

C Interview Questions and Answers


(Continued from previous question...)

Why did printf ..

Q: Why did printf("%d %d", f1(), f2()); call f2 first? I thought the comma operator guaranteed left-to-right evaluation.

A: The comma operator does guarantee left-to-right evaluation, but the commas separating the arguments in a function call are not comma operators. The order of evaluation of the arguments to a function call is unspecified.

(Continued on next question...)

Other Interview Questions