✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
We want to 'destroy' a list, i.e. free() all the cells in it.
we propose the following function :
void destroyList(t_list *ptr_list){ t_cell *cur; t_cell *prev; while (ptr_list->head !=NULL) { cur = ptr_list->head; prev = cur; while (cur->next != NULL) { prev = cur; cur = cur->next; } prev->next = NULL;
free(cur); }
}
What can you say about this function? (several answers)