在多维数组中,数组的维数应该大于1。下图展示了一个维数为3 x 3 x 3的多维数组的内存分配策略。

这是一个用C++编写的初始化多维数组的程序。
算法
Begin
Initialize the elements of a multidimensional array.
Print the size of the array.
Display the content of the array.
End
示例
#include<iostream>
using namespace std;
int main()
{
int r, c;
int a[][2] = {{3,1},{7,6}};
cout<< "Size of the Array:"<<sizeof(a)<<"
";
cout<< "Content of the Array:"<<sizeof(a)<<"
";
for(r=0; r<2; r++) {
for(c=0; c<2; c++) {
cout << " " << a[r][c];
}
cout << "
";
}
return 0;
}
输
.........................................................