Suppose I declare int v[]={1,2,3,4,5};
I have been taught that v is a pointer to the first element in the v array. When I call apply sizeof to v, it returns 20, which I know is 5*sizeof(int), because there are 5 elements in the array.
v+0 is also a pointer to the first element in the array, but sizeof(v+0) is 4.
Why is sizeof(v)=20 and sizeof(v+0)=4?
I would expect that sizeof(v) also returned 4, as v is a pointer, but instead it somehow also contains the information regarding the number of elements stored in the array. What is the explanation for this?