hello everyone,
i have been given a task in my class to create a student database. it has to be able to allow a user to enter a class code, class name and a linked list of students enrolled in the class. the struct we have been given to use is below:

struct class
{
char class_code[5];
char *class_name;
nodepointer students_enrolled;
}

typedef struct node *nodepointer;
struct node
{
char *student_name;
nodepointer next;
}

an array of size of 20 structs must be used to store the info.
of course im not looking for anyone to do all the work for me but im looking for some help getting started.

cheers

There are a lot of different kinds of databases, from simple text files, binary files, SQL relational databases (such as MySQL). The node structure doesn't lend itself to binary files very well because of that character pointer.

Since the linked list will be relatively short you would probably want to read the entire list into memory when the program starts, then write it back out with all the changes before the program ends.

I would design the text file so that the class name appears between brackets, so that the program can distinguish it from student names, something like this:

[class1]
student1
student2
student3
[class2]
student4
student5

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.