current position:Home>Why is the first output 40 and the second output 4?

Why is the first output 40 and the second output 4?

2022-02-02 19:52:07 CSDN Q & A

int a[10] = { 1, 2, 3, 4, 5 };
printf("%d \n", sizeof(a));

int main(int a[10]) { //

printf("%d \n", sizeof(a));printf("%d \n", sizeof(&a));

};




Refer to the answer 1:

first a[10] ten int Elements 4*10=40 byte
the second int Type address 4 byte




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021952068025.html

Random recommended