Falk Hueffner wrote:
> "Michael Kerrisk" <[EMAIL PROTECTED]> writes:
>
> > I have fixed this in the upstream 2.21 release by including a small
> > example that demonstrates how strcmp() should be used (like in the
> > page you refer to).
>
> Thanks for your quick reply. Just another minor suggestion, the
> example code uses:
>
> qsort(months, nr_of_months, sizeof(struct mi), compmi);
> [...]
> res = bsearch(&key, months, nr_of_months,
> sizeof(struct mi), compmi);
>
> I think it would be better to use
>
> qsort(months, nr_of_months, sizeof *months, compmi);
> [...]
> res = bsearch(&key, months, nr_of_months,
> sizeof *months, compmi);
>
I don't think so. From the declaration months is of type
struct mi[]. Thus, the size of each element is sizeof(struct mi),
logically.
Regards,
Joey
--
Life is too short to run proprietary software. -- Bdale Garbee
Please always Cc to me when replying to me on the lists.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]