ProgrammingHardTCS NQT · Infosys

#define MIN(a,b) ((a)<(b)?(a):(b)). What does printf("%d", MIN(MIN(3,1),2)) print?

  1. A. 1
  2. B. 2
  3. C. 3
  4. D. 0

Correct answer: A. 1

The inner MIN gives 1, and then MIN(1,2) gives 1. The fully parenthesised macro body makes nested use safe.

More C Programming questions

Exams that ask this topic