ProgrammingHardWipro NLTH · C

What is printed?

What is printed?
enum { A, B = 5, C, D = C + 2, E };
printf("%d %d %d", C, D, E);
  1. A. 2 4 5
  2. B. 6 7 8
  3. C. 6 8 8
  4. D. 6 8 9

Correct answer: D. 6 8 9

An enumerator without a value is the previous plus 1: C = 6, D = 6 + 2 = 8, E = 9.

More C Programming questions

Exams that ask this topic