Given an arbitrary value for a pointer, you can certainly check if it happens to be a value close to NULL, or equal to a compiler filled value like 0xCCCCCCCC, and if you really get your hands dirty, you can with a high degreee of accuracy tell if is points to within the stack vs the heap. However, none of this will EVER guarantee you that it points to something valid.
You must never write a program such that you have to determine afterwards whether a pointer value is valid or not. You must always already know whether it is valid or not, and this often means tracking it yourself. Commonly we track an invalid pointer by setting it to NULL. Other ways might be to have a decicated boolean variable alongside the pointer.
If you ignore this advice you're going to screw yourself.