如下面的代码:如果指针被释放,怎么样它指向的内容?它会受到影响吗?
typedef struct list {
...
...
struct Data *data;
} List;
List* list = (List*)malloc(sizeof(List))
struct Data* data = (struct Data*) malloc(sizeof(struct Data));
.....// here fill the `data`
list->data = data;
....
struct Data* new_data = list->data;
free(list); /* my question is: will this `free` influence `new_data` */
我有一个结构清单,其中有一个指针,它指向的一些内容, 如果IST被释放,指针也被释放 怎么样new_data
,它是否受到影响? 谢谢!