Record Database

This program allows the user to create, remove, and print records on the database. Records contain name, address, and an account number. The records are stored in a database in numerical order by its account number. No records can have the same account number. When adding a record with an already existing account number the account number will be incremented to the next available account number. When exiting the program, the records added/deleted will be updated in the database.

In this project, I gained deeper knowledge on memory management. In a project where you have a lot of objects, it is critical in C programming to understand how memory is stored and how to retrieve data from the correct memory access. Dealing with pointers and using the heap presented some challenges, but it allowed me to understand how computers work. Another thing I learned was the basic C standard IO functions to read and write to files.

Code

Record objects where stored in a singly linked list. Below is the properties of a Record object.

Record

struct record
{
    int                accountno;
    char               name[25];
    char               address[80];
    struct record*     next;
};

void addRecord (struct record **, int, char [ ],char [ ]);
int printRecord (struct record *, int);
void printAllRecords(struct record *);
int deleteRecord(struct record **, int);
int readfile(struct record **, char []);
void writefile(struct record *, char []);

Sample Output