A dangling pointer is a pointer that points to the unavailable memory location or data which is not valid,
for eg:
#include<iostream.h>
void main(){
int *ptr1;
int *ptr2 = new int;
ptr1=ptr2;
delete ptr2;
}
In the above example, ptr1 and ptr2 are pointing to the same location in memory.
but after deletion of ptr2. Ptr1 can not able to point any memory.
This is called as dangling pointer.