✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
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)