For one dimensional array, I have no problem accessing array element. For example --
#include<typeinfo>
#include<iostream>
#include<vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;
int main()
{
int a[3] = {1, 2, 3};
cout << *(a + 0);
return 0;
}
But when I am trying for 2 dimensional array, I am getting output of the kind --
#include<typeinfo>
#include<iostream>
#include<vector>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::string;
int main()
{
int a[][3] = {1, 2, 3};
cout << *(a + 2);
return 0;
}
Output --
0x7ffca0f7ebcc
How can I get output as 2(I will get 2 either by row major or column major order, but c++ follows row major array representation) in the format described in 1st example?