Ehh just so you know there is an easier way that involves some elementary pointer arithmetic.
Code:
int main()
{
int **myArray;
int rows = 10, cols = 3;
myArray = new int*[rows];
myArray[0] = new int[rows * cols];
for( int k = 1; k < rows; k++ ) {
myArray[k] = myArray[0] + (k * cols);
}
// use myArray
delete [] myArray[0];
delete [] myArray;
}
Basically the key part to this is the for loop. If you can correctly assign the pointers in the first dimension to their respective columns, like here, then you can use the familiar myArray[i][j] syntax with just two allocations to manage.
You will have to repeat this code when you reallocate for a bigger matrix.