Thanks to everyone who mailed me with the solution to how to use qsort(). Basically after you have defined the structure you do: qsort((char *) info, 49, sizeof(the_srtuct), compare); int compare(ptr1, ptr2) struct the_struct *ptr1; struct the_struct *ptr2; { return (strcmp(ptr1->name, ptr2->name)); }