I'm new in programming, so please forgive in case of any mistakes.
I created an array using dyanamic allocation, and put the values in it. While finding the length of the array,I'm getting 2 as answer.
what's the reason ?
int *arr;
arr=(int*)calloc(5,sizeof(int));
arr[0]=1,arr[1]=2,arr[2]=3,arr[3]=4,arr[4]=5;
printf("%ld",sizeof(arr)/sizeof(arr[0]));
Since the array size is allocated to be 5 the length should be 5 , but in compiler it's showing 2.