ProgrammingHardGATE CS · TCS NQT

What does this C program print? #define SQ(x) x*x printf("%d", SQ(2+3) / SQ(1+1));

  1. A. 3
  2. B. 6
  3. C. 11
  4. D. 13

Correct answer: D. 13

Macro arguments are not parenthesised, so the expression becomes 2+3*2+3/1+1*1+1. By precedence this is 2 + 6 + 3 + 1 + 1 = 13; neither 25/4 = 6 nor 11/3 = 3 results.

More C Programming questions

Exams that ask this topic