Linked Lists
Hello
I have a problem with link lists. This is my code to initialize the LLs.
for(f=b;f;f=f->next)
{
Now it loops until I break with some condition
}
The result looks like this
??!f!?? f = f->next f=f->next->next etc.
Now at the end of the loop f has the value f->next.... .What I want to ask is how can i get it to store only the first ??!f!?? in another variable?
Cheers Jens Jung
The iterator in your for loop sets f to f->next
Why would you initialize a linked list that is already created?
Whenever you add a node, set its next to NULL. When you create the list, set its head to NULL.
There are prolly some tutorials on linked lists on this site.
Or just use the STL list template and save yourself some time.
Why would you initialize a linked list that is already created?
Whenever you add a node, set its next to NULL. When you create the list, set its head to NULL.
|
There are prolly some tutorials on linked lists on this site.
Or just use the STL list template and save yourself some time.
Mmmmm...not absoultely sure what you''re trying to accomplish. Whats wrong with just saying
?
|
?
quote:
Original post by Big B
There are prolly some tutorials on linked lists on this site.
Or just use the STL list template and save yourself some time.
Yup, here: http://www.gamedev.net/reference/programming/features/uds1/default.asp.
Kevin
Admin for GameDev.net.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement