Just as we extracted the typedef, enum, and struct instances, along with the functions for the Card and Hand structures, we will do the same for Deck structures. Take the following steps:
- Create and open the deck.h header file and put in the following new lines:
#ifndef _DECK_H_
#define _DECK_H_
#endif
This is our starting point for this header file. Looking again through carddeck.c, we see that there is oneconst int related to Hand that we need to add as an enum, as follows:
enum {
kCardsInDeck = 52
};
- We can next addtypedef struct { … } Deck;and the four function definitions related to the Deck structure—InitializeDeck(),ShuffleDeck(),DealCardFromDeck(), andPrintDeck(). However, notice that the Deck structure contains twoCard arrays and one function returns a Card*, pointer to Card structure, therefore the compiler will need to know about...