Checking if value pointed by pointer still alive?
Author |
Message |
Saad
|
Posted: 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
|
|
|
PaulButler
|
Posted: 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
|
Posted: Sat Oct 20, 2007 11:58 am Post subject: RE:Checking if value pointed by pointer still alive? |
|
|
Thanks for the help. |
|
|
|
|
|
|
|