I have a struct which looks like this:
struct employee
{
char name[21], surname[21];
unsigned int salary;
}employees[20];
My question is, how would I sort this array of structs by the field "name", sorting them alphabetically.
I've seen people use sort()
or qsort()
, but I don't know how to make the compare()
that you usually have to make for those sorting algorithms.