I am trying to program poker game in C. I am not allowed to change the function:
void eval_strength(struct hand *h){
//mycode
}
void eval_players_best_hand(struct player *p){
int i;
p ->best_hand = p->hands[0];
for(i=0; i <MAX_COMBINATIONS; i++){
if(eval_strength(p->hands[i])) > p->best_hand){
p->best_hand = p->hands[i];
}
}
Can someone help me fix these errors please!
poker.c: In function ‘eval_players_best_hand’:
poker.c:181:15: error: incompatible types when assigning to type ‘struct hand *’ from type ‘struct hand’
p->best_hand = p->hands[0];
^
poker.c:183:21: error: incompatible type for argument 1 of ‘eval_strength’
if((eval_strength(p->hands[i])) > p->best_hand){
In the functions void eval_players_best_hand(struct player *p) I am trying to evaluate the strength of the hand, for each hand in the array. Then I have to point best_hand to the strongest hand . eval_strength is another function that will set the hands vector according to its strength.