With #define SQUARE(x) x*x, what does SQUARE(2 + 3) evaluate to?
-
A
13
-
B
10
-
C
11
Correct answer
-
D
25
12 views
Explanation
The macro expands to 2 + 3 * 2 + 3 without parentheses, so operator precedence makes the result 11.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ