#include <iostream>
using namespace std;
int main(){
int a[2][3]={{1,2,3},{4,5,6}};
int (*p)[3]=a;
cout << p[1][2] << endl;
cout << p[1][1] << endl;
system("pause");
return 0;
}
#include <iostream>
using namespace std;
int main(){
int a[2][3]={{1,2,3},{4,5,6}};
int (*p)[3]=a;
for(int i = 0;i < 2;i ++)
{
printf("%d\n",a + i);
int *q = (int *)(a + i);
printf(" %d\n",q[2]);
}
int **matrix;
int i,j;
int bb=2;
int aa=3;
matrix=(int **)malloc((bb)*sizeof(int *));
for(i=0;i<bb;i++)
{
matrix[i]=(int *)malloc(aa*sizeof(int));
}
for(i = 0; i < 2;i ++)
{
for(j = 0;j < 3;j ++)
{
matrix[i][j] = a[i][j];
}
}
printf("%d\n",&matrix[0]);
printf("%d\n",matrix);
for(int i = 0;i < 2;i ++)
{
printf("%d\n",matrix + i);
int *q = (*(matrix + i));
printf(" %d\n",q[2]);
}
system("pause");
return 0;
}