ProgrammingHard

The matrix int a[3][3] = {[1][1] = 5}; is zero-initialised everywhere else (C99 designators). What is a[0][0] + a[1][1] + a[2][2]?

  1. A. 0
  2. B. 5
  3. C. 15
  4. D. 10

Correct answer: B. 5

Only a[1][1] is set to 5 by the designator. The other elements are zero, so the sum is 5.

More C Programming questions

Exams that ask this topic