|
|
|
|
|
|
|
// Delete currPtr->link
delPtr = currPtr->link;
currPtr->link = currPtr->link->link;
}
delete delPtr;
} |
|
|
|
|
|
|
|
|
Let's delete the node whose component is 90. The structure is shown below, with the nodes labeled as they are when the While statement is reached. |
|
|
|
|
| |
|
|
|
|
while (currPtr->link->component != item)
currPtr = currPtr->link; |
|
|
|
|  |
|
|
|
|
Because 50 is not equal to 90, the loop body is entered. |
|
|
|
 |
|
|
|
|
Pointer is advanced. |
|
|
|
| |
|
|
|