But whenever I try to add more than 1 node to my program:
1 2 3 4 5
List story;
story.addNode(1);
story.display();
story.addNode(2);
story.display();
it just stops working. It doesn't freeze up, it just sits there perpetually with the cursor blinking. I'm not overly confident with the concept of nesting structures, and I'm lucky I actually got it to sort of work, but it would be appreciated if someone could tell me what I'm doing wrong.
If first node -> next is not null pointer, it will go for another iteration of the loop and check first node again, and again, and again...
Also in your List::getNode you do not return anything if nothing was found. It will lead to stack corruption and obscure bugs. Return null pointer instead.
Thank you sooo much, kind sir!! Fixed my problem, plus, I was getting those warnings after compile, but I didn't know what to do about them. Now I know :) Thank you
EDIT: One last question, if you have the time: The reason I'm using nested structures is because I didn't want each node to have the node-related functions unnecessarily. Is that what this code will achieve?