See the following program, sizeof is resulting different output for the different function. Can someone explain this/
#include<stdio.h>
void main()
{
int arr[]={1,2,3,4,5};
printf("length: %d\n",sizeof(arr));
printf("length: %d\n",sizeof(arr)/sizeof(int));
show(arr);
}
void show(int ar[])
{
printf("length: %d\n", sizeof(ar));
printf("length: %d\n", sizeof(ar)/sizeof(int));
}
Output
length: 20
length: 5
length: 4
length: 1