|  |
|
|
|
|
A variable of type NodeType is created. The pointer is stored into head. Variable head will remain unchanged as the pointer to the first node (that is, head is the external pointer to the list). |
|
|
|
|
|  |
|
|
|
|
The first number is read into the component member of the first node in the list. |
|
|
|
|
|  |
|
|
|
|
currPtr now points to the last node (the only node) in the list. |
|
|
|
|
|  |
|
|
|
|
The next number (if there is one) is read into variable inputVal. |
|
|
|
|
|  |
|
|
|
|
An event-controlled loop is used to read input values until end-of-file occurs. |
|
|
|
|
|
|
|
|
|
newNodePtr = new NodeType; |
|
|
|
|  |
|
|
|
|
Another variable of type NodeType is created, with newNodePtr pointing to it. |
|
|
|
|