Hi,
I've working on this for hours now...
Here is my structure
Code:
#define MAX_ITEM 10
typedef struct {
int stk_num,items_in_stk,min_stk,itm_on_ord,supplier;
float reord_price;
char desc[26],ord_ref[9];
} record;
record List[MAX_ITEM];
I am trying to display the contents in ascending order using qsort() function. This is how I am calling the sort function
Code:
qsort(List, MAX_ITEM, sizeof(List[0]), cmp_element);
And this is my comp_element function with which I am having problem and I can't figure it out myself
Code:
int cmp_element(record *ptr1, record *ptr2 )
{
return strcmp(ptr1->desc , ptr2->desc);
}
But I am getting this error
Code:
[C++ Error] Stock4.c(206): E2342 Type mismatch in parameter '__fcmp' (wanted 'int (*)(const void *,const void *)', got 'int (*)(record *,record *)')
I believe its a very minor problem somewhere but I can't find it myself and time is running out...
Help please.....