如以下代码所示:
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
,是否受到影响?谢谢!