void RemoveDuplicates ( NODE**head) {
NODE *pCurrent = *head;
if(pCurrent ==NULL)
return;
else {
while(pCurrent ->next !=NULL) {
if(pCurrent ->data == pCurrent ->next->data) {
NODE *nnext = pCurrent ->next->next;
free(pCurrent ->next);
pCurrent ->next = nnext;
}
else
pCurrent =pCurrent ->next;
}
}
}
No comments:
Post a Comment