ProgrammingHardGATE CS · Campus placements

void f(int a[10]) { printf("%zu", sizeof a); } Which statement about the result is correct?

  1. A. It prints 40 on every platform, because the bound 10 is part of the parameter
  2. B. It prints sizeof(int), because a is a single int
  3. C. It prints sizeof(int *), not 40, because the parameter is adjusted to a pointer
  4. D. It prints the size of the caller's array, because the array is passed by value

Correct answer: C. It prints sizeof(int *), not 40, because the parameter is adjusted to a pointer

An array parameter declaration adjusts to a pointer type, so sizeof a gives the size of a pointer. The 10 in the declarator is ignored, and the array is not copied.

More C Programming questions

Exams that ask this topic