Re: qsort >
> > blbp_eom_isr_revenue.c", line 739: warning 527: Integral value
> > implicitly converted to pointer in assignment.
> > blbp_eom_isr_revenue.c", line 739: warning 563: Argument #4 is not the
> > correct type.
> qsort((void *)Buff,
> totalRecs,
> sizeof(strcture_name),
> (int) (*blbp_CtnRecCompare));
the prototype for qsort(3C) is
void qsort(
void *base,
size_t nel,
size_t size,
int (*compar)(const void *, const void *)
);
the last parameter is not int, its a pointer to a function that returns
int.
so blbp_CtnRecCompare should not be cast to int. this is what the
warning is about.
> > and the function blbp_CtnRecCompare is -
> > int blbp_CtnRecCompare (strcture_name Rec_1,
> > strcture_name Rec_2)
> > {
> > return (strcmp (Rec_1.field_name, Rec_2.field_name));
> > }
>
>
> I think the comparison function wants to take 2 pointers rather than
> 2 structures.
qsort expects a pointer to a function that takes pointer parameters,
not
struct's. |