By the defination of Dangling Pointers I don't understand what does exectly it mean in c language
Can anyone tell me what is dangling pointer in my code ?
Code:#include <stdlib.h>#include <stdio.h> int main() { int *ptr = malloc(sizeof(*ptr)); if( ptr == NULL ) /*Check for failure. */ { puts( "Memory not allocated" ); exit( 0 ); } puts( "Allocated memory!" ); free(ptr); /*Release memory. */ }