I am trying to fix this code in C for an employee database. Employee can be searched by ID and if no record found then the 'Sorry record not found!' message is displayed.
void del() {
char id[10];
printf("\n\t Delete which record?:");
gets(id);
curr = start;
if (strcmp(start->name, name) == 0) {
start = start->next;
free(curr);
printf("\n\t First record deleted!");
return;
}
while (curr) {
if (strcmp(curr->next->name, name) == 0) {
curr->next = curr->next->next;
printf("\n\n\t Record Deleted!");
return;
}
curr = curr->next;
}
printf("\n\n\t Sorry record not found!");
}