Hi all! I have this project to do - and I am having a couple of problems implementing the spec.
Ok - the project has two parts - the first being the design of a..
"suite of functions that will create and maintain any number of doubly linked lists. These functions should be designed in such a way that they will be able to manipulate a list containing data of any type."
...
"The structure of the list should therefore be similar to the following".
Code:
typedef struct list DLL;
typedef struct node NODE;
struct node
{
void *data;
NODE *prior, *next;
};
struct list
{
long int count;
NODE *head, *tail;
};
Ok - that is fine - but part two really gets me. I have to write a "test" program to test the functions to ensure that the functions will work for any data type. Now the test program is not aloud to access any of the previous structures components directly.
This is the bit that is confusing me (refering to the second part, the test program):
"The test program that you are to design should thouroughly test all aspects of the doubly linked list routines. As part of the testing, a seperate linked list is to be created and maintained for each of the following data types: long integers, floats, character strings, and complex structures."
Code:
typedef struct
{
long int id;
char name[MAX];
char address[MAX];
float salary;
} PERSON;
typedef struct
{
PERSON details;
char department[MAX];
char position[MAX];
} EMPLOYEE;
Questions:
1. Making a list of type int, etc is easy - how would I do the same for the complex structure?
TIA