In the below code I free the pointer ptr
but still *ptr
retuns me the same value. If I free the variable then it should give me some garbage value but it didn't.
#include <stdio.h>
#include<stdlib.h>
int main()
{
int a=5;
int *ptr=&a;
printf("%d, %d \n",a,*ptr);
free(ptr);
printf("%d, %d \n",a,*ptr);
return 0;
}