qsort()

Belgarath garath at irie.ais.org
Mon Apr 22 10:26:27 AEST 1991


	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));
}




More information about the Comp.lang.c mailing list