   Delphi linked list
  I have a linked list with the last item pointing to the begin of the list. The items consist out of a char and a pointer.Now i have made a list with 5 children:-) a to e. And i give in a number in an edit field and i walk the list until i get to that number and delete that child from the list. And so one until there is only one left.But i don''t get it right. Everytime the wrong child. How would you solve this??thanx in advance 
  A little code would be helpful to see where you''ve gone wrong... ;  I have the code not right at hand therefore i didn''t post it but i shall try it to write it down.procedure doIt(childrenlist : pList, number:integer)var i : integer   last,now: pList;begin  last := nil;  now := childrenlist;  i := 0;  while now^.next <> now^.next do  begin    if i < number then    begin last := now; now := now^.next;    end    else    begin now := now^.next; last^.next := now;endendit was something like this but i think it has something to do with the beginpointer childrenlist, because the last item points to that to make a circle ;  is pList your own type ?Why not just use TList ? True linked lists are more of a C thing, in Delphi I prefer to use dynamic arrays of classes when I never do deletes.Also, does while now^.next <> now^.next do   work at all ? Seems to me it will always return false and skip the loop ? Or does reading now^.next change data in the record ? ;  2 things forget to tellone that i inc(i) in the loop en if it is greater than 3 i make it zero againand it has to be now <> now^.next because at the end the last one that is left has to point to itself because it is a circle thus than it has to end. ;quote:Original post by Fidelio66  is pList your own type ?Why not just use TList ?  People always say this. But there is also a "learning factor" to things. Making something yourself is a good learning experiences. He probably wants to learn something, not just write a better version of TList.Toolmaker -Earth is 98% full. Please delete anybody you can. ;  Shouldn''t you be incrementing i?   [ DGDev -- The Delphi Games Development Community ] [ Help GameDev.net fight cancer ];  yep thats true i forget to tell that i increment i