I am stumped as to how to be able to store values from an array that is using pointers. Here is the code:
The program deals out 5 cards of a poker hand and then prints the values of the 5 cards to the console. I would like to be able to store the values so that I can then use the values of the cards to determine if the hand has a pair, 3 of a kind, etc. I need to get over this problem so that I can do the rest of the program. Please advise. Thanks!Code:/* Poker program */ #include <stdio.h> #include <stdlib.h> #include <time.h> #define num_faces 13 #define num_suits 4 #define cards_in_hand 5 void shuffle(int [][num_faces]); void deal(int [][num_faces], char *[], char *[]); void main() { char *suit[num_suits]={"Clubs", "Diamonds", "Hearts", "Spades"}; char *face[num_faces]={"Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"}; int deck[num_suits][num_faces] = {0}; srand(time(0)); shuffle(deck); deal(deck, face, suit); } /* Function to use random generator to get random suit and random card values */ void shuffle(int workdeck[][13]) { int card, row, column; for(card = 1; card <= num_suits * num_faces; card++) { row = rand() % num_suits; column = rand() % num_faces; while(workdeck[row][column] != 0) { row = rand() % num_suits; column = rand() % num_faces; } workdeck[row][column] = card; } } /* Function to output to console (print) suit and card values */ void deal(int workdeck2[][13], char *workface[], char *worksuit[]) { int card, row, column; for (card = 1; card <= cards_in_hand; card++) { for (row = 0; row <= 3; row++) { for (column = 0; column <= 12; column++) if (workdeck2[row][column] == card) { printf("\n%5s of %-8s", workface[column], worksuit[row]); } } } }


