home
search
help
profile
liking the experience? our app is even better
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now  
showing results for how to clear a linked list c 2b 2b
1void llDeleteNode(List &list, Node* node)
2{
3	if(list == node)
4		list = llNext(list);
5	else
6	{
7		List temp = list;
8		while (llNext(temp) != node)
9			temp = llNext(temp);
10
11		temp->next = node->next;
12	}
13
14	delete node;
15}
16
17void llClear(List &list)
18{
19	while(list != NULL)
20		llDeleteNode(list, list);
21}
upvote
downvote