Dangling pointers in programming are pointers which do not point to a valid object.

As an example you allocate a memory using a pointer and deleted it or deallocated using some other pointer and not modifying the value of the first pointer, so now the pointer still points to the memory location of the deallocated memory.

Now if you request the system for reallocation, the previously freed memory may be allocated to another process, and the previous pointer become the dangling pointer.