We have already seen how to create a Hand structure that consists of the Card structures, as follows:
typedef struct {
int cardsDealt;
Card card1;
Card card2;
Card card3;
Card card4;
Card card5;
} Hand;
Hand is a structure that represents a collection of cards dealt with that hand. In this case, Hand contains five individual instances of a Card structure, each of them named card1 through card5. The cardsDealtmember variable allows us to keep track of how many cards are in a hand.
Add the preceding structure definition to carddeck_2.c.
When you consider this structure, you might wonder why an array of Card structures is not used instead. Since an array is a collection of identical times, an array might be more appropriate than five named variables. In reality, using an array is an approach we will take later. For now, we want to explore accessing structures within structures. In the next section...