2D arrays such as:Cell **scoreTable.After allocating:
scoreTable = new Ceil*[10];
for(int i = 0 ;i<10;i++)
scoreTable[i] = new Ceil[9];
And I want to save the value like this:scoreTable[i][j]= new Ceil(i,j) in heap,and this can not work in c++.Thanks for help.
Once you’ve allocated your array like this, you’ll already have a 2D array of
Cell, so you don’t need to use thenewkeyword to change the value.If you give your
Cellclass a method likeSetValue(i,j), then you can use it like this:scoreTable[i][j].SetValue(i,j);