I don't understand what is Dangling pointers in c language
we can allocate dyamic memory for variables and we can also free it
pointer can point to memory location of another variable
https://en.wikipedia.org/wiki/Dangl...ing object,location of the deallocated memory.
we can allocate dyamic memory for variables and we can also free it
pointer can point to memory location of another variable
https://en.wikipedia.org/wiki/Dangl...ing object,location of the deallocated memory.
Code:
#include <stdlib.h>
void func()
{
char *dp = malloc(sizeof(*dp));
/* ... */
free(dp);
/* ... */
}