NodeT *list; // pointer to first Node in list
NodeT *p; // pointer to "current" Node in list
p = list;
while (p != NULL) {
… do something with p->data …
p = p->next;
}
// which is frequently written as
for (p = list; p != NULL; p = p->next) {
… do something with p->data …
}
|