Article View: fj.sys.rs6000
Article #33Re: qsort on AIX3.2.5.5
From: Hiroaki Sengoku
Date: Wed, 17 Jan 1996 00:00
Date: Wed, 17 Jan 1996 00:00
32 lines
1683 bytes
1683 bytes
$B@g@P!wF|N)$G$9!#$3!<$$$&OCBj$O(B followup $B$,;&E~$7$=$&$G62$$!#(B
<IIDA.96Jan16210907@sayla.secom-sis.co.jp> $B$K$*$$$F(B
16 Jan 1996 21:09:07 +0900 $B$K(B IIDA, Yosiaki $B$5$s$O=q$-$^$7$?(B:
IIDA,> qsort ((char *)vector, nelt, sizeof(int),
IIDA,> (int(*)(const void *,const void *))compar);
...
IIDA,> static int compar (const int *a, const int *b)
IIDA,> {
IIDA,> return (*b < *a);
^^^^^^^^^
IIDA,> }
*a - *b $B$H$9$Y$-$G$O(B ?
qsort(3) $B$r8+$k$H!"(B
| qsort(base, nel, width, compar)
| char *base;
| int (*compar)();
...
| compar is the name of the comparison function, which is called
| with two arguments that point to the elements being compared. As
| the function must return an integer less than, equal to, or
| greater than zero, so must the first argument to be considered be
| less than, equal to, or greater than the second.
$B$H=q$$$F$"$j$^$9!#(B
$B@g@P(B $B9@L@(B @ $B@n:j;T(B
#1831 sengoku@gcd.forus.or.jp
<A HREF="http://www.yajima.kuis.kyoto-u.ac.jp/staffs/sengoku/">info.</A>
Technical Details
Message-ID:
<4di6dh$2ja@sohya.sdl.hitachi.co.jp>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<IIDA.96Jan16210907@sayla.secom-sis.co.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: f5470,dc83b2058c49045b,start X-Google-Attributes: gidf5470,public X-Google-Thread: 106434,dc83b2058c49045b,start X-Google-Attributes: gid106434,public From: sengoku@sdl.hitachi.co.jp (Hiroaki Sengoku) Subject: Re: qsort on AIX3.2.5.5 Date: 1996/01/17 Message-ID: <4di6dh$2ja@sohya.sdl.hitachi.co.jp> X-Deja-AN: 135479789 references: <IIDA.96Jan16210907@sayla.secom-sis.co.jp> organization: Systems Development Lab., Hitachi Ltd., JAPAN newsgroups: fj.sys.rs6000,fj.lang.c