Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   how to delete this? (http://www.velocityreviews.com/forums/t284616-how-to-delete-this.html)

Kyle 07-26-2004 09:19 AM

how to delete this?
 
I have the following codes

int (*p)[2];
p=new int [4][2];
....
delete [] p;

is the way to free the memory correct?



Gernot Frisch 07-26-2004 09:25 AM

Re: how to delete this?
 

"Kyle" <zhouzhendong@hotmail.com> schrieb im Newsbeitrag
news:4104cc86@dnews.tpgi.com.au...
> I have the following codes
>
> int (*p)[2];
> p=new int [4][2];
> ...
> delete [] p;
>
> is the way to free the memory correct?


Yep. delete [] p; p=NULL; // indicate it's invalid!

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com




All times are GMT. The time now is 08:47 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.