Anamika PrajapatKnowledge Contributor
What do you mean by dangling pointers and how are dangling pointers different from memory leaks in C programming?
What do you mean by dangling pointers and how are dangling pointers different from memory leaks in C programming?
Pointers pointing to deallocated memory blocks in C Programming are known as dangling pointers i.e, whenever a pointer is pointing to a memory location and In case the variable is deleted and the pointer still points to that same memory location then it is known as a dangling pointer variable.
In C programming memory leak occurs when we allocate memory with the help of the malloc() or calloc() library function, but we forget to free the allocated memory with the help of the free() library function. Memory leak causes the program to use an undefined amount of memory from the RAM which makes it unavailable for other running programs this causes our program to crash.