int a[2][2] = {1,2,3,4};
int a[2][2] ={(1,2),(3,4),(5,6),(7,8)};
分析:
int a ={1,2,3,4,5};与 int a = 5; 同
//附源代码
typedef int inta2[2][2];
typedef int inta1[2];
int main()
{
int a[2][2][2] ={{{1,2},{3,4}},{{5,6},{7,8}}};
int b = (1,3,4,5);
inta1 (*p1)[2] = a;
inta2 *p2 = a;
int i,j,k;
for (i=0;i <2;i++)
{
for (j=0;j <2;j++)
{
for (k=0;k <2;k++)
{
cout<<"p1["<<i<<j<<k<<"]:"<<p1[i][j][k]<<endl;
}
}
}
for (i=0;i <2;i++)
{
for (j=0;j <2;j++)
{
for (k=0;k <2;k++)
{
cout<<"p2["<<i<<j<<k<<"]:"<<p2[i][j][k]<<endl;
}
}
}
}