定义一个a[2][3]的二维数组,并将所存的值输出(使用三种方式输出:数组名【下标】、数组地址和指针变量)。

C++写程序。现在急需~!谢谢各位大大的~~QAQ

#include <iostream>
using namespace std;
int main()
{
int i,j,a[][3]={{1,2,3},{4,5,6}};
for(i=0;i<2;i++)
for(j=0;j<3;j++)
cout<<a[i][j]<<'\t';
cout<<endl;
for(i=0;i<2;i++)
for(j=0;j<3;j++)
cout<<*(*(a+i)+j)<<'\t';
cout<<endl;
system("pause");
}
温馨提示:答案为网友推荐,仅供参考
相似回答