I've a question for a warning message that i get. For this line,using qsort library function:
qsort(catalog, MAX ,sizeof catalog, struct_cmp_by_amount);
I get this warning:
warning: passing argument 4 of ‘qsort’ makes pointer from integer without a cast
EDIT:
struct_cmp_by_amount is the following function on the program.(--->) catalog is a struct and MAX is defined as 100
BUT,for another program with the same code, with the same exactly struct_cmp_by_amount function, i dont get that warning for the 4th argument!
EDIT: I've also have to say that on both programs i havent used prototypes of functions! But for the 2nd program it works normally in contrast to the 1st one.
qsort(structs, structs_len, sizeof(struct st_ex), struct_cmp_by_amount);
EDIT:
st_ex is a struct
struct st_ex structs[]={./*elements*/..}
size_t structs_len = sizeof(structs) / sizeof(struct st_ex);
int struct_cmp_by_amount(const void *a, const void *b)
{
struct catalogue *ia = (struct catalogue *)a;
struct catalogue *ib = (struct catalogue *)b;
return (int)(100.f*ia->amount - 100.f*ib->amount);
}
I'm wandering about why that's happening. Have you any ideas?