shuffling and dealing cards

How do I access the data in the structure before so that I can get access to the bit values.This is just an extract of the whole program.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
struct card { 
 const char *face;
 const char *suit;
 const char *color;
};

typedef struct card Card;
typedef unsigned char pairs;


// function  that is to be used to compare two card faces but is not working well.Error :no match for 'operator&' in 'cd1 & 60' 
int compareface(const void* c1, const void *c2)
{

card cd1,cd2;

cd1=*((card*) c1);
cd2=*((card*) c2);

cd1.face= (cd1&0x3c)>>2;
cd2= (cd2&0x3c)>>2;

if(cd1>cd2)
return 1;
if(cd1==cd2)
return 0;

return -1;
}
Last edited on
Topic archived. No new replies allowed.