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
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты