|
|
|
|
|
|
|
How old is your cat? (0 to stop): 12
How old is your cat? (0 to stop): 2
How old is your cat? (0 to stop): 14
How old is your cat? (0 to stop): 6
How old is your cat? (0 to stop): 0
What value? (0 to stop): 3
What value? (0 to stop): 9
What value? (0 to stop): 1
What value? (0 to stop): 5
What value? (0 to stop): 0
This cat is 2 years old
This cat is 6 years old
This cat is 12 years old
This cat is 14 years old |
|
|
|
|
|
|
|
|
Deleting Data object with value: 9
Deleting Data object with value: 5
Deleting Data object with value: 3
Deleting Data object with value: 1
Deleting 14 years old Cat.
Deleting 12 years old Cat.
Deleting 6 years old Cat.
Deleting 2 years old Cat. |
|
|
|
|
|
|
|
|
Analysis: This code is much like the previous example, but this time we pass the LinkedLists by reference to their respective functions for processing. This is a powerful feature. After the lists are instantiated, they can be treated as fully defined types, passed into functions, and returned as values. |
|
|
|
|
|