Hi,
I've working on this for hours now...
Here is my structure
I am trying to display the contents in ascending order using qsort() function. This is how I am calling the sort functionCode:#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];
And this is my comp_element function with which I am having problem and I can't figure it out myselfCode:qsort(List, MAX_ITEM, sizeof(List[0]), cmp_element);![]()
But I am getting this errorCode:int cmp_element(record *ptr1, record *ptr2 ) { return strcmp(ptr1->desc , ptr2->desc); }
I believe its a very minor problem somewhere but I can't find it myself and time is running out...Code:[C++ Error] Stock4.c(206): E2342 Type mismatch in parameter '__fcmp' (wanted 'int (*)(const void *,const void *)', got 'int (*)(record *,record *)')
Help please.....



LinkBack URL
About LinkBacks




