ProgrammingModerate

int main(void) { int a[] = {1, 2, 3}; printf("%zu", sizeof a / sizeof a[0]); } What is printed?

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

Correct answer: C. 3

sizeof a is 12 bytes and sizeof a[0] is 4, so the division gives the element count, 3.

More C Programming questions

Exams that ask this topic