ProgrammingHardTCS NQT · Infosys

int g[2][3] = {1, 2, 3, 4}; What is g[1][1] + g[0][2]?

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

Correct answer: D. 3

Brace-less initialisation fills row 0 with 1, 2, 3 and row 1 with 4, 0, 0. So g[1][1] is 0 and g[0][2] is 3, giving 3.

More C Programming questions

Exams that ask this topic