ProgrammingHard

int x = 2; switch (x) { case 2: x += 1; case 3: x += 10; break; default: x = 0; } printf("%d", x); What is printed?

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

Correct answer: B. 13

Execution falls through from case 2 into case 3, so 2 + 1 + 10 = 13 before the break.

More C Programming questions

Exams that ask this topic