Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Checking if value pointed by pointer still alive?
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Saad




PostPosted: Fri Oct 19, 2007 5:29 pm   Post subject: Checking if value pointed by pointer still alive?

I was wondering, is there a way to check if a pointer still to an object that is still allocated?
Sponsor
Sponsor
Sponsor
sponsor
PaulButler




PostPosted: Sat Oct 20, 2007 10:02 am   Post subject: RE:Checking if value pointed by pointer still alive?

You should set the pointer to NULL after deallocating the memory, and then just check if the pointer is NULL to see if the object is still allocated. Leaving pointers pointed to deallocated memory is considered dangerous.
Saad




PostPosted: Sat Oct 20, 2007 11:58 am   Post subject: RE:Checking if value pointed by pointer still alive?

Thanks for the help.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: