What will be the value of the c variable after the following code is executed?
int a, b = a = 0, c;
if (b != a++)
    c = 1;
else if (b == --a)
    c = 2;
Variables a and b are set to 0 in the first line. Variable a is incremented by 1 after the condition check, which is false, in the second line. Therefore, code's execution will be passed to the fourth line. The value of a will be decremented by 1 before the condition check. Condition will become true, therefore variable c will be assigned a value of 2.

Следи за CodeGalaxy

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

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