go to previous page   go to home page   hear noise

Answer:

Break it.


End of Chapter

Yes. Break it into a main routine and two subroutines, create and print. Other things you can try: add several more data fields to the nodes. Modify the creation and printing routines.

Add some code that asks the user for the number of nodes to create in the linked list. Perhaps add nodes in ascending order or descenting order.

Try altering the program so that each node contains a string that the user types in. To start, put the strings in a fixed-length field of each node. After that is working, further modify the program so each node is allocated only enough memory for its string and its link field. This will be really interesting.

For something less interesting, review the following concepts:


go to previous page   go to home page