Below, in my program I defined an array of integer type named myArray
. After that it prints the value of both myArray
and &myArray
:
#include <iostream>
using namespace std;
int main()
{
int a[2] = {2,3};
cout<<a<<endl<<&a;
return 0;
}
In the output this two value are equal! For example this is output in my computer:
ap1019@sharifvm:~$ ./a.out
0x799188ebe4d0
0x799188ebe4d0
I know that the identifier of an array is a pointer to the first element of it, but why the value of this pointer is equal with its address?