#include struct DESC_STRUCT { char desc[60]; char date[13]; long incident_no; char user[9]; int status; } desc_array[1000]; void show_array(int kount) { int i = 0; while (i < kount) { printf("'%s' '%s' %5ld\n",desc_array[i].desc,desc_array[i].date, desc_array[i].incident_no); ++i; } } int compare_desc_structs(struct DESC_STRUCT *pa, struct DESC_STRUCT *pb) { int diff; diff = strcmp(pa->date,pb->date); if (diff == 0) { diff = pa->incident_no - pb->incident_no; } return(diff); } int main() { int count; count = load_array(); printf("BEFORE\n"); show_array(count); qsort(desc_array,count,90,compare_desc_structs); printf("AFTER\n"); show_array(count); }