I have learned that we can use the address of elements of an array at index i as &A[i] or simply as A+i
and to get the value
A[i] or *(A+i)
where A is an array and i denotes the Index.
Let's say int A[]={1,2,3};
When I use sizeof(*A) I get value 4, now when I use sizeof(A) I must get the size of address value of the first element why I get the size of the whole array as 12.
I am a beginner and confused, please guide.
sizeof(A), you get the size ofA. Not the size of(A+0)and not the size of&*A. If you assume that A is always the same as A+0 etc. then you are mistaken.If you assume that A is always the same as A+0no I assumedAas&A[0]&A[0]is the same asA+0in this case.