logo

Crowdly

Browser

Add to Chrome

We want to 'destroy' a list, i.e. free() all the cells in it. we propose the fo...

✅ 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)

More questions like this

Want instant access to all verified answers on moodle.myefrei.fr?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome