I'm trying to find out a proper practice of checking if the pointer/array is valid before calling the delete operator. I know I can check if the pointer is a NULL pointer before deciding whether I should call the delete operator, but that doesn't take care of the case of a dangling pointer. In other words, how do I check whether I have proper access to the memory that the pointer is pointing to before calling the delete operator?
Thanks in advance for suggestions.