I am a newbie to pointers and am facing some problems while trying to understand them.
Now I looked up this problem over here. I was not 100% satisfied with the solution. So I did some checking on my own to see what happens.
I wanted a pointer to a two-dimensional array so I tried:
int arr[2][3] = {{12,23,4},{323,43,3}};
int (*ptr)[3] = arr; // A pointer to the first element of array.
// The first element of array is an array of three ints.
I ran the following code:
std::cout<<ptr<<std::endl;
std::cout<<*ptr<<std::endl;
Now the results I got were a bit confusing for me:
0x61fdc0
0x61fdc0
Both times the same output is shown. How can the address of the pointer and value after the referencing be the same? Is this behavior similar to double pointers? An explanation like this will be very helpful.