I have been going through the qsort questions/responses and still cannot figure out what Im doing wrong. The following is what I have:
Code:
int compareface(const void* c1, const void *c2)
{
card cd1,cd2;
cd1=*((card*) c1);
cd2=*((card*) c2);
cd1= (cd1&0x3c)>>2;
cd2= (cd2&0x3c)>>2;
if(cd1>cd2)
return 1;
if(cd1==cd2)
return 0;
return -1;
}
Code:
typedef unsigned char card;
// within main
card hands[5][5];
for(hand=0;hand<5;hand++)
{
for (i=0; i<5; i++)
qsort (hands[hand], 5, sizeof(hands[0]), compareface);
}
When I display the results, it's not in order...can anyone help?