|
-
July 16th, 2010, 11:07 AM
#4
Re: incremented loop question
Well, if I was doing this, I'd first loop through all the nodes in the list. Then I'd use the node in the list from that loop as the starting point in a second loop. In the second loop I'd print the list from the selected node to the end.
Something like this:
Code:
for(int i = 0; i < list_size; i++)
{
for(int j = i; j < list_size; j++)
{
// print all list nodes indexed by j
}
}
Of course, you'd have to adjust this if you really have to delete a node each time through.
BTW, it would help if you show us all your code when you post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|