ProgrammingHard

Given int a[3][4] and int *q = &a[0][0], which element does q[5] refer to?

  1. A. a[1][2]
  2. B. a[0][5]
  3. C. a[1][1]
  4. D. a[2][1]

Correct answer: C. a[1][1]

q[5] is the element at flat index 5. With 4 columns that is row 1 and column 1, so a[1][1].

More C Programming questions

Exams that ask this topic