freeing linked lists

This is a discussion on freeing linked lists within the C Programming forums, part of the General Programming Boards category; I am again trying to learn how to create linked lists. This time think I'll be more successful at it. ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    380

    freeing linked lists

    I am again trying to learn how to create linked lists. This time think I'll be more successful at it.

    Anyways when I free a list do I have to set the head node or pointer to NULL or else I'll get a never ending loop?
    Don't you dare hit me on the head, you know I'm not normal.
    A Stooge Site
    Green Frog Software

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    That will be part of the design.

    If in your list design, you decide that "head == NULL" means the list is empty, then you'll want to set the head to null when the list is free'd or becomes empty.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked Lists 101
    By The Brain in forum C++ Programming
    Replies: 5
    Last Post: 07-24-2004, 04:32 PM
  2. Map file formats and linked lists
    By Spitball in forum Game Programming
    Replies: 2
    Last Post: 03-04-2004, 10:32 PM
  3. Freeing Linked Lists
    By mrpickle in forum C Programming
    Replies: 4
    Last Post: 01-21-2004, 06:57 PM
  4. need help w/ linked lists
    By MKashlev in forum C++ Programming
    Replies: 11
    Last Post: 08-05-2002, 08:57 PM
  5. doubly linked lists
    By qwertiop in forum C++ Programming
    Replies: 3
    Last Post: 10-03-2001, 06:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21