In the carddeck_1.c program, we need to model a deck of cards. To do this, we will create an array of the Card structures, as follows:
Card deck[52];
With this statement, we have created an array of 52 cards.
Note how, in the preceding definition, 52 is a magic number; that is, it is a literal number that has a special meaning. However, there is no context associated with that number unless it is stated in the comments. One problem with magic numbers is that as a program evolves or is applied to different uses, the magic numbers aren't all always updated properly. To avoid this problem, we will define some convenience constants, as follows:
enum {
kCardsinDeck = 52,
kCardsinHand = 5,
kCardsinSuit = 13,
kNumHands = 4
}
This enum statement declares four constants whose values we defined for each one, these are named literal constants. We would like to have used the following:
const int...