This is how you could set up a basic matrix. Observe the very details!
Code:
#include <iostream>
using namespace std;
//--
int main()
{
int** Matrix;
unsigned nRows(3);
unsigned nCols(4);
Matrix = new int*[nRows];
if (Matrix != 0)
{
for(unsigned i = 0; i < nRows; ++i)
{
Matrix[i] = new int[nCols];
}
}
//Let's see how we delete them. Watch closely.
for(unsigned i = 0; i < nRows; ++i)
{
delete[] Matrix[i];
}
delete[] Matrix;
return 0;
}