< previous page page_1078 next page >

Page 1078
while (currPtr->link->component != item)


delPtr = currPtr->link;
currPtr->link = currPtr->link->link;
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
Because 90 is equal to 90, the loop is exited.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
The link member of the node whose component is 90 is copied into the link member of the node whose component is 50. The link member equals NULL in this case.
1078-01.gif
delete delPtr;
Memory allocated to *delPtr (the node that was deleted) is returned to the free store. The value of delPtr is undefined.

Note that NULL was stored into currPtr->link only because the node whose component was 90 was the last one in the list. If there had been more nodes beyond this one, a pointer to the next node would have been stored into currPtr->link.
Pointer Expressions
As you can see from the OrdList::Delete function, pointer expressions can be quite complex. Let's look at some examples.
1078-02.gif

 
< previous page page_1078 next page >