cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Deleting a pointer twice
Deleting a pointer twice
Aug 13, 2014 at 8:09am UTC
mehak
(94)
when we delete a pointer that was pointing to an object,the memory allocated in the free store is released ,but if i happen to delete the pointer twice which now points to nothing,i.e.,NULL,it may corrupt the heap store and cause a trap.
Aug 13, 2014 at 8:22am UTC
Duthomhas
(13206)
Er... what?
Yes
, deleting a
non-
NULL
pointer twice causes heap corruption.
No
, deleting
NULL
has no ill effect.
http://www.cplusplus.com/reference/new/operator%20delete/
Topic archived. No new replies allowed.