A typical solution is to use a linked list. For example, here's how you might set up your employee list:
typedef struct EmployeeStruct {
.....char name[50];
.....int age;
.....int salary;
.....char gender; // 'M' = male, 'F' = female
.....struct EmployeeStruct *next;
}Employee;
// keep pointers to the first and last node in the list
Employee* listHead = null;
Employee* listTail = null;
// This function appends an employee to the back to the list.
void Insert(Employee* e) {
.....if (listHead == null) { // if listHead is null, then the list is empty
..........listHead = e;
..........listTail = e;
.....} else {
..........listTail->next = e;
..........listTail = e;
.....}
}
// This function compares the given string to the name field of all Employee records in the list.
// It returns a pointer to the first matching Employee record.
// If no match is found, then it returns null.
Employee* FindEmployeeByName(const char* name) {
.....Employee* e = listHead;
.....while(e != null) {
..........if (strcmp(e->name, name) == 0) {
...............return e;
..........}
..........e = e->next;
.....}
.....return null; // no employee by that name was found
}