ProgrammingModerate

int a[3][4]; what do sizeof a / sizeof a[0] and sizeof a[0] / sizeof a[0][0] give?

  1. A. 3 and 4
  2. B. 4 and 3
  3. C. 12 and 4
  4. D. 3 and 12

Correct answer: A. 3 and 4

The first expression counts the rows, 3, and the second counts the columns, 4. sizeof gives sizes in bytes, so the ratios give counts.

More C Programming questions

Exams that ask this topic