c++ linked list

Discussion in 'Computer Science & Culture' started by gram1234, Mar 18, 2003.

Thread Status:
Not open for further replies.
  1. gram1234 Registered Member

    Messages:
    18
    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;
    }
    }
    }
     
Thread Status:
Not open for further replies.

Share This Page