🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Pointers and 2D Arrays: all 15 questions

Quiz: Pointers and 2D Arrays · Question 12 of 15

What does this print? (code)

What does this print?

#include <stdio.h>
int main(void) {
    int m[3][4];
    printf("%zu %zu\n", sizeof(m) / sizeof(m[0]), sizeof(m[0]) / sizeof(m[0][0]));
    return 0;
}
  1. A.12 4
  2. B.3 4
  3. C.4 3
  4. D.3 12
Answer & explanation

Correct answer: 3 4

sizeof(m) / sizeof(one row) gives the number of rows (3); sizeof(one row) / sizeof(one int) gives the number of columns (4).

Can you get the rest right without peeking?

Take the timed Quiz: Pointers and 2D Arrays quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →