|
-
April 17th, 2009, 05:15 PM
#3
Re: Question regarding the use of a 2 dimensional array
 Originally Posted by ZuK
No. It should be
Code:
Terrain::~Terrain() {
for (int i=0; i<x; i++) // you have to store x and y as class members
delete [] terrainArray[i];
delete [] terrainArray;
}
Kurt
Thanks, I had a feeling this wouldn't free all the memory. Storing x and y as class members isn't a problem. I was probably going to do that anyway since when I draw the terrain I will need to know how many times I have to loop. That way i can just ask for terrain->x and terrain->y.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|