Hi I'm having trouble understanding how structs work ...
i have two structs ...
struct card{
int value;
string name;
}
and
struct deck{
int currentcardonto p;
int decksize;
card cards[40];
}
My question is if I'm trying to access the "currentcardont op" and then find the "name" associated with that card from the card struct ... how would I go about doing that?
currently, I have something along the lines of:
struct deck ONE;
and then ONE.cards[currentcardonto p].name .... it just seems really off to me cause of my complete lack of understanding for structures ... could someone please help me understand these things?
i have two structs ...
struct card{
int value;
string name;
}
and
struct deck{
int currentcardonto p;
int decksize;
card cards[40];
}
My question is if I'm trying to access the "currentcardont op" and then find the "name" associated with that card from the card struct ... how would I go about doing that?
currently, I have something along the lines of:
struct deck ONE;
and then ONE.cards[currentcardonto p].name .... it just seems really off to me cause of my complete lack of understanding for structures ... could someone please help me understand these things?
Comment