A

Admin • 833K Points
Coach

Q. What is the output of the following?

Code:
#define SQUARE(x) x*x
printf("%d", SQUARE(3+1));
  • (A) 16
  • (B) 7
  • (C) 13
  • (D) Compiler Error
  • Correct Answer - Option(B)
  • Views: 22
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

Macro expands to 3+1*3+1 = 3+3+1 = 7 due to lack of parentheses.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.