replace the return in cmp_name function with this:
Code:
in this function:
int cmp_name(const void *a, const void *b)
{
return(strcmp(a,b));
//return strcmp(((struct element*)a)->name, ((struct element*)b)->name);
}
This is an elegant program, but clearly several steps above where you are with C. Nice as it is, I'd look
for code help in the future, that was more at your level, or just above it.
I don't think you learn much from turning in someone else's program "whole hog". This program looks
nothing like a program from a beginner.
and it works ok, in very limited testing.