I'm very new to C and am working on a card game. I've got my cards and shuffle down, but I want each card to have a name.
I made my cards inside an array of structs:
struct card
{
int value;
int suits;
int points;
char name[20];
};
int main()
{
struct card deck[52];
..
..
..
..
Now I'm just trying to find a way to print out the name strings which I have defined later like this:
deck[0].name=="2 of Diamonds";
deck[1].name=="3 of Diamonds";
..
..
and now I want to print out the name of the card. This is what I have, it compiles, but doesn't print. Am I defining the string wrong? Defining the names wrong? Using the printf wrong?
printf("%s", deck[0].name);
Why won't they print right? Thanks in advance.
Greg