c - if a pointer is freed, how about the content it points to? will it be influenced or not? -


as in following code:

typedef struct list {   ...   ...   struct data *data; } list;  list* list = (list*)malloc(sizeof(list)) struct data* data = (struct data*) malloc(sizeof(struct data));   .....// here fill `data`  list->data = data;  ....  struct data* new_data = list->data;  free(list); /* question is: `free` influence `new_data` */ 

i have structure list, in there pointer, points content, if ist freed, pointer freed how new_data, influenced or not? thanks!

the contents of new_data not affected. still valid after "parent" data freed.


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -