Package: glibc-doc
Version: 2.3.2.ds1-22

The example for qsort has, among other things:

     int
     critter_cmp (const struct critter *c1, const struct critter *c2)
     {
       return strcmp (c1->name, c2->name);
     }

     /* ... */

       result = bsearch (&target, muppets, count, sizeof (struct critter),
                         critter_cmp);

     /* ... */

       qsort (muppets, count, sizeof (struct critter), critter_cmp);

This is incorrect.  The comparison function must be declared as

  int critter_cmp (const void *c1, const void *c2)

and should use casts to convert to the proper type.

ttfn/rjk


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to