Are the following operators valid? If they are, what will be the values of the variables x and y?
int x = (1,024); // --1--
int y;
y = 1,024; // --2--
Explanation
The first statement consists of two expressions, separated by a comma operator. The value of the whole expression is the value of the right expression 024, 20 in the octal notation.
The second statement is also correct, but due to the priority of operations it will execute only assignment operation: (y = 1), 024; The last value is not used.

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести