i'm trying to do a biggest card game in c
but i'm reciving some errors that i can't figure out
please help me...
the functions are separeted of the main(project)
i'm receving the error 'incompatible types in assignment' in the function compare card
/*This function compares card1 with card2 and returns 0 if the cards are equals,
-1 if card1 < cadr2 and else 1. The comparison is done considerating the value
absolute of the card. The bigger value is the biggest card. In case of tie (2 or most cards
with the same value), the suit must be verificate, considerating the follow order:
Diamonds < Spades < Hearts < Clubs.
Example: 10 of Diamonds < 10 of Spades < 10 of Hearts < 10 of Clubs
king of Diamonds > 10 of Clubs */
typedef struct{
SUIT suit;
int value;
}CARD;
typedef struct{
CARD *cards[52];
int atual; /*indicates the next card to be withdrawal of the deck*/
}DECK;
typedef struct{
char name[30];
CARD hand[3];
CARD biggest_card;
int num_victories;
}PLAYER;
int compare_card(CARD *card1, CARD *card2)
{
PLAYER players;
if(card1->valor == card2->valor)
{
if(card1->suit < card2->suit)
{
players.biggest_card = card2;
return -1;
}
else
{
players.biggest_card = card1;
return 1;
}
}
else
{
if(card->value < card2->value)
{
players.biggest_card = card2;
return -1;
}
else
{
players.biggest_card = card1;
return 1;
}
}
}
i'm using DevC++
ps: sorry, my english is not very good.