This program is about finding size of integer array and its elements size ,printing the size of
array a[]
in function void print_size(int a[])
,it is showing sizeof(a)
as 8 whereas in int main()
function sizeof(a)
is 12. How is the output
for sizeof(a)
function given in void print_size(int a[])
is 8 but in int main()
function sizeof(a)
is 12 ,on running the program .
Here is code given below:
#include <stdio.h>
void print_size(int a[])
{
printf("%d %d ",sizeof(a),sizeof(a[3]));
}
int main()
{
int a[]={1,2,3};
printf("%d %d \n",sizeof(a),sizeof(a[-1]));
print_size(a);
return 0;
}