Fixed search the student
This commit is contained in:
parent
7bffb64752
commit
f8749e3427
@ -241,7 +241,7 @@ void search_student()
|
||||
STUDENT *found_student = search_student_by_name_or_id(search_key);
|
||||
if (found_student == NULL)
|
||||
{
|
||||
printf("No student found!");
|
||||
printf("\nNo student found!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -260,6 +260,13 @@ STUDENT *search_student_by_name_or_id(char search_key[NAME_SIZE])
|
||||
if (strcmp(temp->student_info.name, search_key) == 0 || strcmp(temp->student_info.id, search_key) == 0)
|
||||
{
|
||||
printf("\nSearch found with key: %s\n", search_key);
|
||||
// set the temp next to null
|
||||
// and free up the memory
|
||||
temp->next = NULL;
|
||||
free(temp->next);
|
||||
|
||||
// return the current temp
|
||||
// that found in current search
|
||||
return temp;
|
||||
}
|
||||
temp = temp->next;
|
||||
|
Loading…
Reference in New Issue
Block a user