Thread: C - Removing Lists or parts

  1. #1
    Registered User
    Join Date
    Dec 2001

    C - Removing Lists or parts

    We need help with a code. We need to be able to remove the entire list or just a part of the list. We need this ASAP so please respond with a good reply. Thanks

  2. #2
    A list? I'll assume you're using a linked list, since you've posted no code.

    void removeList( Node *listStart )
    { if ( listStart ) { removeList( listStart->next ); free( listStart ); }

    For removing a single node, it's just a matter of making sure the pointers are correct, then freeing up that space:

    prevNode->next = currentNode->next;
    free( currentNode );


  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Let me again state how much I hate the timer on your signin/signout on this board...

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Removing parts of a string...
    By Junior89 in forum C++ Programming
    Replies: 2
    Last Post: 07-01-2007, 02:10 AM
  2. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  3. removing parts of an image?
    By pode in forum Game Programming
    Replies: 6
    Last Post: 12-18-2002, 06:41 AM
  4. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  5. Linked lists and file i/o, and some other stuff
    By ninja in forum C++ Programming
    Replies: 9
    Last Post: 05-19-2002, 07:15 PM