deleting a node in linked list

This is a discussion on deleting a node in linked list within the C Programming forums, part of the General Programming Boards category; Well I suppose it depends if your loop is circular or not. Does your last node point to your first ...

  1. #16
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Well I suppose it depends if your loop is circular or not. Does your last node point to your first node? If so, you'll be fine, you'll just end up looping through the whole list. You'll still have the problem with the passed list being NULL though.


    Quzah
    Hope is the first step on the road to disappointment.

  2. #17
    Brak BoneXXX's Avatar
    Join Date
    Mar 2007
    Location
    Bangkok
    Posts
    62
    The last node points to null and when the program reaches there it stops looping [ while(current != NULL) ]. Maybe this is not the answer you asked for but I will stop working with this program now, because If I continue, I will confuse myself again
    “Example isn't another way to teach, it is the only way to teach” Albert Einstein

  3. #18
    Registered User
    Join Date
    Nov 2007
    Location
    Singapore
    Posts
    24
    wrong post ignore sorry

  4. #19
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Quote Originally Posted by BoneXXX View Post
    The last node points to null and when the program reaches there it stops looping [ while(current != NULL) ]. Maybe this is not the answer you asked for but I will stop working with this program now, because If I continue, I will confuse myself again
    The difference between people who become real programmers and people who just want to get a passing grade in a class, is that the later are prefectly happy to remain ignorant.

    You currently have no way of deleting the first node of the list. You can delete every other item though, so I suppose you'll just get your passing mark.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pleas take a look & give a critique
    By sh3rpa in forum C++ Programming
    Replies: 14
    Last Post: 10-19-2007, 11:01 PM
  2. Reverse function for linked list
    By Brigs76 in forum C++ Programming
    Replies: 1
    Last Post: 10-25-2006, 11:01 AM
  3. Problems with deleting a node in a singly linked list
    By omishompi in forum C++ Programming
    Replies: 7
    Last Post: 02-23-2006, 06:27 PM
  4. Problem with linked list ADT and incomplete structure
    By prawntoast in forum C Programming
    Replies: 1
    Last Post: 04-30-2005, 02:29 AM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 11:21 PM

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