I want them to have different size arrays they are pointing to.
cagestotal is another integer, that changes as well.
When I use new to make them it looks like this:
Code: Select all
cages2 = new int *[cagestotal];
cagenums = new int [cagestotal];
Code: Select all
for(int i=0; i<cagestotal; i++)
{
cages2[i] = new int [cagenums[i]];
}
But.. when I want to change the size of the arrays and start again, I tried using this code:
Code: Select all
delete [] cages2;
delete cagenums;
When I replace this code with the code below it works:
Code: Select all
for(int i=0; i<cagestotal; i++)
{
delete cages2[i];
}
Code: Select all
delete cages2
Do I need to use delete like this so that I can remake the arrays to a different size?
Thanks
Mark