Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: qsort() Message-ID: <15938@smoke.brl.mil> Date: 22 Apr 91 17:59:46 GMT References: <1991Apr22.002627.14535@engin.umich.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 13 In article <1991Apr22.002627.14535@engin.umich.edu> garath@irie.ais.org (Belgarath) writes: - 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)); -} I don't know who mailed you that, but it is utterly wrong!