View Full Version : c++ linked list


gram1234
03-18-03, 10:23 AM
here's some of the code for a function to remove duplicates,not will sure about the comments that i have or what other ones i should use.input appreciated.here's the code:


while(ptr!=gone && ptr->data!=gone->data)
ptr=ptr->link;
if(ptr==gone) // not found back in list
{
last->link=gone;
last=last->link;
gone=gone->link;
}
else // found so skip over
{
ptr=gone->link;
last->link=gone->link;
delete gone;
gone=ptr;
}
}
}