ProgrammingModerate

const char *names[] = {"zero", "one", "two"}; printf("%c", names[2][1]); What is printed?

  1. A. t
  2. B. o
  3. C. w
  4. D. z

Correct answer: C. w

names[2] is "two" and index 1 is its second character, 'w', since indices start at 0. 't' is index 0 and 'o' is index 2 of the same string, the usual off-by-one slips.

More C Programming questions

Exams that ask this topic