sorting members of structure array
Given a structure array (in C) I am attempting to print out the results in groups of gender and in sub order by numerical order. For example: struct employee{ char gender[13] char name[13]; int id; }; Say I define the structure array like so: struct employee info[2]={{"male","Matt",1234},{"female","Jessica",2345},{"male","Josh",1235}}; How could I go about printing the results like 1234 Matt 1235 Josh 2345 Jessica You'll need to implement a sorting function that compares the structs as you require int compare(const void *s1, const void *s2) { struct employee *e1 = (struct employee *)s1; struct