6.8 Linked Lists and Structures |
Study areas:
malloc()
& free()
.
Hanly & Koffman Section 14.2, page 682.
Kernighan page 167.
Harbison Chapter 16 Storage Allocation.
Oualline Page 281.
Set up a double linked list with forward and backward pointers with dynamically allocated structures. The structure should have 3 elements. A character, a forward link, and a backwards link.
The program, without comments was, for me 125 lines.
At the start of your program print out:
Then it needs to:
For the following input:
abcdzyxw F4B4FQ
your program should print:
Your name CIS265 Louis Taber Lab: 6.8: Linked Lists and Structures 8 abcdwxyz zyxwcba abcxyz 15
Hints:
free
each structure deleted.
struct letter char lett; struct letter *forward; struct letter *backward; ;
Test your program with the following sample data set.
8888B8888F qwertyuiopasdfghjklzxcvbnmFB 2222222222222F111111111111F1 qwertyuiopasdfghjklzxcvbnmFB qwertyuiopasdfghjklzxcvbnmFB X
It is available by anonymous FTP at
ftp://lt.tucson.az.us/pub/c/link.dat.
Turn in a copy of your program and its output when used with the above test data marked with:
6.8 Linked Lists and Structures |