1 /* Test case by Paul Eggert <eggert@twinsun.com> */
5 struct big
{ char c
[4 * 1024]; };
11 compare (void const *a1
, void const *b1
)
13 struct big
const *a
= a1
;
14 struct big
const *b
= b1
;
15 if (! (array
<= a
&& a
< array_end
16 && array
<= b
&& b
< array_end
))
20 return b
->c
[0] - a
->c
[0];
24 main (int argc
, char **argv
)
27 size_t array_members
= argv
[1] ? atoi (argv
[1]) : 50;
28 array
= (struct big
*) malloc (array_members
* sizeof *array
);
35 array_end
= array
+ array_members
;
36 for (i
= 0; i
< array_members
; i
++)
37 array
[i
].c
[0] = i
% 128;
39 qsort (array
, array_members
, sizeof *array
, compare
);