What will be in the value of variable res after execution of the following code?
int a = 5;
int data[3];
data[0] = 10;
int res = a * data[0] / (data[0] = 5);
The correct answer is that the result is not defined; it works similarly to calculating function arguments (without any particular order). That is, an expression is evaluated from right to left, but one compiler can calculate all the operands in advance in any order, and the other can start evaluating the expression and, as necessary, calculate the operands.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes