previous
|
index
|
next
Simulating list Display
To display a list pointed to by
lst
as Scheme would:
Display a left parenthesis "("
While
lst
points to something, do:
Display the item at the head of the list pointed to by
lst
Change the pointer
lst
to the next item in the list
If
lst
still points to something, display a blank space, otherwise display a right parenthesis ")"
Display a new line character
void displayList(list lst) { cout << endl << "("; while ( lst != NULL ) {
cout << lst->item;
}
previous
|
index
|
next