I don\'t understand the difference between a dangling pointer and a memory leak. How are these two terms related?
A pointer pointing to a memory location that has been deleted (or freed) is called dangling pointer. There are three different ways where Pointer acts as dangling pointer.
- De-allocation of memory
- Function Call
- Variable goes out of scope
—— from https://www.geeksforgeeks.org/dangling-void-null-wild-pointers/