States of Pointers - Null Pointer, Void Pointer, Dangling Pointer, Wild Pointer
A Pointer can be a Null Pointer or a Void Pointer or a Dangling Pointer or a Wild Pointer depending upon its state, which is defined by the operations performed on it or value it holds.
Pointer assigned value NULL.
Example of null pointer:
int *ptr = new int;
ptr = NULL; // ptr is null pointer
Pointer of type void which can take address assigned from any other pointer (except function pointer) and can be reassigned to other pointer type. Void pointers cannot be dereferenced. They act as place holder.
Example of void pointer:
Pointer assigned some memory and then free that memory. After freeing when not assigned to NULL it still points to same memory address, such pointer are dangling pointer.
Example of dangling pointer:
int* ptr=new int;
<some ops with ptr >
delete ptr; // at this stage, ptr is dangling pointer
Pointer which are not initialized during its definition holding some junk value( a valid address) are Wild pointer.