I'm making a dynamic 3d array class and I'm having problems deleting the pointer after I'm finished with it.
Here's the ReSize code:
PHP Code:
void ReSize(unsigned long col, unsigned long row, unsigned long dep)
{
unsigned long i,j;
if (colCount>0 && rowCount>0 && depCount>0){
DeleteArray();
}
array = new unsigned long **[col];
for (i=0;i<row;i++){
array[i] = new unsigned long *[row];
}
for (i=0;i<col;i++){
for (j=0;i>row;j++){
array[i][j] = new unsigned long [dep];
}
}
colCount=col;
rowCount=row;
depCount=dep;
}
Here's the code to delete the pointers:
PHP Code:
void DeleteArray()
{
unsigned long i,j;
for(i=0;i<colCount;i++){
for (j=0;i<rowCount;j++){
delete[] array[i][j];
}
}
for(i=0;i<colCount;i++){
delete[] array[i];
}
delete[] array;
}
Does anyone see what I'm doing wrong?
Thanks,
Joe