1// allocate
2int** matrix = new int*[rowCount];
3for(int i = 0; i < rowCount; i++)
4 matrix[i] = new int[colCount];
5
6// free
7for(int i = 0 ; i < rowCount; i++)
8 delete[] matrix[i]; // delete array within matrix
9delete[] matrix; // delete actual matrix