📅  最后修改于: 2022-03-11 14:44:56.879000             🧑  作者: Mango
// allocate
int** matrix = new int*[rowCount];
for(int i = 0; i < rowCount; i++)
matrix[i] = new int[colCount];
// free
for(int i = 0 ; i < rowCount; i++)
delete[] matrix[i]; // delete array within matrix
delete[] matrix; // delete actual matrix