Kamis, 19 April 2012

Deleting a node in the linklist

Here is my code to delete all the nodes having the value passed in the argument. typedef struct nodetype { int data; struct nodetype * next; } node; typedef node * list; void Linklist::deleteNode(list * head, int value) { list current = *head; list previous = *head; while(current != NULL) { if(current->data != value) { previous = current;

0 comments:

Posting Komentar