For the following code
#include<iostream>
using namespace std;
int main(){
int arr[10];
arr[0]=28;
cout<<arr<<endl<<&arr<<endl<<*arr<<endl;
return 0;
}
The output is:
0x22fe88
0x22fe88
28
My doubt is that why is the value of arr and &arr same? What I know is that arr is a pointer to the first element of the array i.e. arr is same as &arr[0] and since arr is a pointer, it means that it should also have its own memory address where it is stored in memory. So why &arr and arr gives the same output? arr is supposed to give the address of first element whereas &arr should give the address of arr pointer itself. Please explain in detail.