ProgrammingVery hardGATE CS · Product company OA

On an LP64 system (8-byte pointers, 4-byte int), what is printed?

On an LP64 system (8-byte pointers, 4-byte int), what is printed?
int a[10];
printf("%zu %zu %zu", sizeof(&a), sizeof(*&a), sizeof(a + 0));
  1. A. 8 40 8
  2. B. 40 40 40
  3. C. 40 40 8
  4. D. 8 8 8

Correct answer: A. 8 40 8

&a is a pointer (to the whole array), so 8. *&a is the array itself again, so sizeof sees 10 ints: 40. In a + 0 the array decays to int * before the addition, so the operand is a pointer: 8.

More C Programming questions

Exams that ask this topic