//allocate the array
int** arr = new int*[row];
for(int i = 0; i < row; i++)
arr[i] = new int[col];
// use the array
//deallocate the array
for(int i = 0; i < row; i++)
delete[] arr[i];
delete[] arr;
如果您想要一个固定的大小,那么它们必须声明为 const:
const int row = 8;
const int col = 8;
int arr[row][col];