The code is below.
My question is about the result. I want to understand, why after calling free(p) p->elem turns to '0', but the p->str still contains "hello"?
#define LEN (sizeof(struct node))
typedef struct node
{
int elem;
char *str;
}*p_node;
int main(void)
{
p_node p;
p=(p_node)malloc(LEN);
p->elem=99;
p->str="hello";
printf("the p->elem:%d\n",p->elem);
printf("the p->str :%s\n",p->str);
free(p);
printf("the p->elem:%d\n",p->elem);
printf("the p->str :%s\n",p->str);
return 0;
}