Problem with a struct within a struct

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • konsept
    New Member
    • Nov 2006
    • 1

    Problem with a struct within a struct

    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?
  • idshiy
    New Member
    • Nov 2006
    • 4

    #2
    one thing i can tell, what u have is not a structure in structure. the currentcardonto p should be a type of card.

    in ur struct use
    struct card currentcardonto p

    Comment

    Working...