For given macro definition, what will be printed to the console?
#define Some_operation(x, y) ((x) + (y) - 1) / (y)

int main()
std::cout<< sizeof Some_operation(1,2);
The precompiler will generate the following code: std::cout << sizeof ((1) + (2) - 1) / (2);
Since sizeof operator has a higher priority, it will be evaluated first, and then the result will be divided by 2, hence, the final result is 2.

Слідкуй за CodeGalaxy

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

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