Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > how to delete this?

Reply
Thread Tools

how to delete this?

 
 
Kyle
Guest
Posts: n/a
 
      07-26-2004
I have the following codes

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

is the way to free the memory correct?


 
Reply With Quote
 
 
 
 
Gernot Frisch
Guest
Posts: n/a
 
      07-26-2004

"Kyle" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
To delete or not to delete? Lethal Computer Support 15 07-24-2005 11:47 PM
Can someone tell me why I can't delete this file? and why it blue screens WinXP Pro on delete? zZz Computer Support 1 01-12-2005 02:37 AM
Cannot Delete, (The Delete Key Won't Work) Lee Something Computer Support 13 10-15-2003 09:51 PM
delete on delete ! Sandeep Grover C++ 19 07-22-2003 10:09 AM



Advertisments