Kay wrote:[color=blue]
> If I want to use a for loop to display the context of the linked list,
> how to write this call ?[/color]
Assuming that 'list_t' is the type of your list class, and that
'next' member of that class designates the link to the next node,
and that 'data' member of that class designates the contents of
each node, something like:
for (list_t* p = &mylist; p != NULL; p = p->next)
display(p->data);
Kay wrote:[color=blue]
> If I want to use a for loop to display the context of the linked list,
> how to write this call ?
>[/color]
If you were using std::list, you could use std::list::iter ator
and a "for" loop. Or use something from <algorithms>.
Have you taken any courses on Data Structures?
Also, you may progress faster by purchasing a book on
data structures. Posting every single problem you encounter
to this newsgroup is a slow method.
Comment