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.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты