ในอาร์เรย์หลายมิติ อาร์เรย์ควรมีมิติมากกว่า 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