Go backward to About your UNIX system
Go up to Labs
Go forward to Processes -- fork() & wait() functions
The C programming language
Write a "C" program that uses structures and pointers. This is
intended to be a short program to re-fresh your "C" programming skills.
If you are comfortable with "C" turn in a current listing of some of your
code. This is not a mandatory assignment.
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.
- Read the standard input.
If the character is a 'F' dump the
list in the forward direction to the standard output. And set the delete
flag to forward. (its should be initialized to forward as well.)
- If the character is a 'B' dump the list in the backwards direction.
Set the delete flag to backwards.
- If you get a numeric value search down the list in the direction specified by
the delete flag and remove that entry.
For example, if you "get" a "5", remove the fifth entry from the list.
For zero do nothing. If the list
is too short do nothing.
- For 'X' and 'Q' exit the program.
- For a new-line print out the number of entries on the linked list.
- For all other characters place them into the linked list in character order.
If the character is already on the list, put it in anyway.
Turn in a printed copy of your program.
ltaber@pima.edu