ProgrammingModerate

char g[2][3] = {"xy", "z"}; printf("%c", g[0][1]); What is printed?

  1. A. y
  2. B. x
  3. C. z
  4. D. 0

Correct answer: A. y

"xy" fills g[0] as 'x', 'y', '\0', so g[0][1] is 'y'. 'z' belongs to g[1], and 'x' is g[0][0], the usual off-by-one slip.

More C Programming questions

Exams that ask this topic