c++ linked list clear
void llDeleteNode(List &list, Node* node)
{
if(list == node)
list = llNext(list);
else
{
List temp = list;
while (llNext(temp) != node)
temp = llNext(temp);
temp->next = node->next;
}
delete node;
}
void llClear(List &list)
{
while(list != NULL)
llDeleteNode(list, list);
}