+ 2
How to destroy an pointer?
4 Answers
+ 2
It should be the other way round because you would reallocate your pointer and delete nothing which does not free the space you saved for p. In my way you dislocate the memory, which frees it then you reset the address stored in the pointer.
+ 2
understand
+ 1
The code is
delete pointerName;
pointername = NULL;
+ 1
So
int *p = NULL;
delete p;