7.8 Linked Lists and Structures |
Write a "C" program that uses structures and pointers. This is intended to be a program to work on your linked list and structures skills.
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: 7.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:
Please turn your lab in to me, Louis Taber, during class, or slide it under the door of Santa Rita Building room A-115 (my office).
7.8 Linked Lists and Structures |