using a qsort to sort struct pointers by different variables
问题 I am attempting to understand the c library qsort in the context of pointers to structs. Here is the existing code that I would like to manipulate: The structure: #define MAX_NAME 20 #define NUM_MONTHS 12 typedef struct EMP { char name[MAX_NAME+1]; int monthSales[NUM_MONTHS]; int total; } Emp; The global initialization of the data and its size: Emp *data;//where all entries are kept int empSize; and I have constructed 2 arrays of Emp pointers that I would like refer to the data in different