// 二维不连续
int* *p1 = new int*[num];
for(int k = 0; k < num; k++) {
p1[k] = new int[3];
}
//delete 也要做循环
int (*p)[3] = new int[num][3]; // 二维连续
delete[] p;
int (*p2)[3][4] = new int[num][3][4]; // 三维连续
memset(p2, 0x1, sizeof(int)*num*3*4);
delete[] p2;
// 或者借用vector
typedef vector<int> VEC;
VEC* vec = new VEC[num];
for (int k = 0; k < num; k++) {
vec[k].resize(3);
}
delete[] vec;
原文:https://www.cnblogs.com/kuikuitage/p/14618807.html