Lab 8 - Finish employee

This lab extends the previous labs 5-7 and must be submitted. (Don't worry - this is the last employee lab :-) )

1) Add a FIRE command to main that will use your findEmployee function you wrote in lab 7 and the release employee that you wrote in lab 6.

You will need to update releaseEmployee to have it remove the employee from the array as well as freeing the storage. It should set the slot to NULL.

Make sure that LIST still works after firing an employee.

2) Define a sort function as below

(You can copy this code directly into your code. You will need to have #include <stdlib.h> near the top of your file. You may need to change the 3 struct Employee to agree with the name you used for your structure.)

Write two comparison functions for use in the sort routine. Each will take two parameters each having the type pointer to pointer to struct Employee and will return an int (-1 for less than, 0 if equal, 1 if greater than).

Each needs to handle the case where one or both pointers is NULL. Try to sort NULLs to the end of the list.

A)compareByName should compare the names of the employees using strcmp.

B)compareBySalary should sort based on the salary of the two employees.

Create a SALARY command that will sort by salary and then display the list and a NAME command that will sort by name and then display the list.

Q1) What does the line in the provided sort function do?
Describe each of the 4 arguments being passed to qsort.
What do we need that big strange cast for the fourth argument?
Q2) Describe generally how we could add a WHERE clause to list that would allow us to see only employees with a certain characteristic. I am not trying to support anything complicated like AND or OR, just WHERE SALARY > 10000.
Extra Credit) Make a guess about why the comparison function takes 2 struct Employee ** parameters (as opposed to struct Employee *)