i have the following struct declared and a function to put values into it
Code:
typedef struct
{
enum Suit suit;
enum Card_Value card;
char card_code[10];
} Card;
void shuffle_deck(Card *p_deck_index)
{
int count_cards = 0, card_found = 0;
int i;
int suit_value, face_value;
char *temp_string;
while (count_cards < 52)
{
suit_value = rand() % 4;
face_value = rand() % 13 + 2;
for (i = 0; i < count_cards + 1; i++)
{
if (p_deck_index[i].suit == suit_value && p_deck_index[i].card == face_value)
{
card_found = 1;
break;
}
}
if (!card_found) //card_found is 0
{
/*
p_deck_index[count_cards].suit = suit_value;
p_deck_index[count_cards].card = face_value;
temp_string = get_card_code(suit_value, face_value);
strcpy(p_deck_index[count_cards].card_code, temp_string));
count_cards ++;
//*/
temp_string = get_card_code(suit_value, face_value);
p_deck_index[count_cards++] = (Card) {suit_value, face_value, *temp_string}; //<--- generates warning here
}
else
{
card_found = 0;
}
}
}
if i use the commented out part it all compiles fine. if i use the other two lines of code i get the warning. what am i missing please
coop