Okay, I'd like to get some help in analyzing the insertion of linked lists. Let's say, your insert() inserts the newly created node at the "tail" of the list. I get the part wherein you set the first-ever created node as the origin node of the list, but what I can't understand is "what if it's not the origin first node in the list"?
From the code below, I can't get how the else part works. Like, when I used the tmpNode earlier, did it "connect" all of the nodes as it traversed through the list? If that is so, then shouldn't the code below work? Like, it doesn't connect the newly nth node to the first node, that's why when I display the contents of the list, only the first one appears.
Thanks, but unfortunately, this is in C... although, I do get the logic in your code (well, somehow). But I hope I'm not asking for too much, but I'd like to know how this insertion really works (like how are the nodes really connected by the pointers)