For given SQUARE macro definition, what value will be shown on a screen after executing next code:
#define SQUARE(x) ((x)*(x))
int m = 4;
SQUARE(++m);
std::cout << r;
Explanation
During the #define directive execution, text substitution of each symbol "X", that was found in the body of the function, to the current value of the variable "m" is performed. Thus, after such type of replacement current, the ​value of "m" is increased by 1.

This code have a mistake. We need to save result int r = SQUARE(++m); and print it after this.

2023 Feb 23, 1:08:31 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes