다차원 배열에서 배열의 차원은 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)<<"\n";
cout<< "Content of the Array:"<<sizeof(a)<<"\n";
for(r=0; r<2; r++) {
for(c=0; c<2; c++) {
cout << " " << a[r][c];
}
cout << "\n";
}
return 0;
} 출력
Size of the Array:16 Content of the Array:16 3 1 7 6