I use only main() function. Not copying any pointer. Why free() function not get NULL value? Whay I can check my wariable is full or empty?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *e = NULL;
printf("before e=%p\n",(void *)e);
e = malloc(sizeof(int));
*e = 7;
printf("after, e=%p\n",(void *)e);
if(e == NULL) { printf("Problemy z pamięcia\n"); return 0; }
printf(" value = %d\n",*e);
free(e);
printf("after free, e=%p\n",(void *)e);
if(e == NULL) printf("is NULL\n");
return 1;
}
result
before e=0
after, e=464027a0
value = 7
after free, e=0x7f82464027a0
why if(e==NULL) is not true? How do it?