Quick question (that is probably a stupid one):
Do pointers go out of the scope when a function/class ends?
I just noticed when reading tutorials or ebooks, that sometimes the writer will set the deleted pointer to 0, and sometimes he will not (assuming the pointer is at the end of the function/class).
ie. at the end of a function: delete pointer; }
but in the class deconstructor: delete pointer; pointer = 0; }
Wouldnt mind knowing so I can just leave out setting it to 0 in my code when its about to go out of the scope.
Youd think I'd know this.. I would have had to have read about it once before... though most documents only tell you that after deleting the allocated memory the point points to it still points there so you should set it to NULL or 0 to make it safe, it also says not to call delete on a NULL or 0 pointer, and it says local variables go out of the scope.. but is a pointer (to a variable) a variable?