Saturday, March 6, 2021

Free a linked list in C

 while(list!=NULL)

{

        node *tmp=list->next;

        free(list);

        list=tmp;

}



source: harvard cs50, david malan



No comments:

Post a Comment