| currPtr = head; |  |
|
|
|
|
currPtr and head both point to the first node in the list. |
|
|
|
|
|
while (currPtr != NULL)
cout << currPtr->component << ' ';
currPtr = currPtr->link; |  |
|
|
|
|
The loop body is entered because currPtr is not NULL. |
|
|
|
|
|
|
|
|
The number 49 is printed. |
|
|
|
 |
|
|
|
|
currPtr now points to the second node in the list. |
|
|
|
|
|
while (currPtr != NULL)
cout << currPtr->component << ' ';
currPtr = currPtr->link; |  |
|
|
|
|
The loop body repeats because currPtr is not NULL. |
|
|
|
|
|
|
|
|
The number 50 is printed. |
|
|
|
 |
|
|
|
|
currPtr now points to the third node in the list. |
|
|
|
|
|