-
Structure Problem
I have 3 files for the program attached. The program works; however, I do have 2 potential problems with it:
1) When I add files to the Personal Information Manager (PIM) structure and then print it everything is fine. When I go back to add more files (before exiting the program) I can add more files, these new files overwrite what was in the structure instead of appending to it WHY?????
2) The 2nd and biggest and more difficult problem is that I have to add a function that will allow me to search the records and delete a record that is selected. The record to be deleted can be any record, first, last, or any in between. Other than a linked list is this possible.
I have searched and can find no inforamtion so far that will allow this except a linked list.
Any suggestions, many thanks in advance.
Alan
-
Assuming count contains the number of entries, this will make it append instead of overwriting the previous entries.
Code:
int add_contact(contact *c, int count)
{
char lname[13];
char fname[11];
char mi[2];
char city[16];
char state[3];
char zip[6];
// Loop to count records and ensure the number of entries does not
// exceed the MAX_CONTACT limit.
//for (int i = 0; i < MAX_CONTACT; i++)
//Change this to:
for (int i = count; i < MAX_CONTACT; i++)
{