What are dangling pointers ?

If a pointer is pointing any memory location but when it releases held memory or some another pointer deletes the memory occupied by it, then pointer still points to that freed memory location. This problem is known as dangling pointer problem.

The memory location is freed and another pointer can manipulate the memory location, but previous pointer still points to that location and value for it is arbitrary or garbage.

Leave a Reply

Your email address will not be published. Required fields are marked *