I like Serena
Science Advisor
Homework Helper
MHB
- 16,335
- 258
mathmari said:(Malthe)
Yes, I want to iterate over the linked list and print some information.
How can I do it then, without using the head?? (Wondering)
Copy the [m]asteroids[/m] data member to a local pointer and use that to iterate. (Mmm)
Also, I suggest to use recognizable names for pointers to important data structures.
It's better to use a name like [m]p[/m] only for iterating over a collection. (Nerd)
So I suggest something like:
Code:
plansys_t *planetarySystem = StarS[k].plasy;
...
asteroid_t *q = planetarySystem ->asteroids;
while (q != NULL) {
...
q = q->next;
}