|
|
|
|
|
|
|
Call 3: head points to the node containing 1066 and is not NULL. Execution of this call pauses until the recursive call with the actual parameter head->link has been completed. |
|
|
|
|
|
|
|
|
Call 4: head points to the node containing 1492 and is not NULL. Execution of this call pauses until the recursive call with the actual parameter head->link has been completed. |
|
|
|
|
|
|
|
|
Call 5: head is NULL. Execution of this call is complete. Control returns to the preceding call. |
|
|
|
|
|
|
|
|
Call 4: head->component (which is 1492) is printed. Execution of this call is complete. Control returns to the preceding call. |
|
|
|
|
|
|
|
|
Call 3: head->component (which is 1066) is printed. Execution of this call is complete. Control returns to the preceding call. |
|
|
|
|
|
|
|
|
Call 2: head->component (which is 78) is printed. Execution of this call is complete. Control returns to the preceding call. |
|
|
|
|
|
|
|
|
Call 1: head->component (which is 45) is printed. Execution of this call is complete. Because this is the nonrecursive call, execution continues with the statement immediately following RevPrint(head). |
|
|
|
|
|
|
|
|
Figure 19-5 shows the execution of the RevPrint function. The actual parameters are pointers (memory addresses), so we use (r) 45 to mean the pointer to the node whose component is 45. |
|
|
|
|
|
|
|
|
Figure 19-5
Execution of RevPrint(head) |
|
|
|
|
|