Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with dealing a deck of cards using C not C++. I've been trying to create two functions to deal a deck of
I need help with dealing a deck of cards using C not C++. I've been trying to create two functions to deal a deck of cards. I've already made the deck and shuffled it. I'm having trouble dealing it to the player. It won't work. Here's what I have.
void RemoveDrawnCard(card* leadNode) {//Removes first/top card from deck /*printf(" "); printDeck(*leadNode);*/ card* targetNode; card* temp = leadNode; targetNode = leadNode; temp = targetNode->next; free(targetNode); printf(" "); } card* CreatePlayerHand(card *leadNode) {//Draws first card and creates Player's hand card* firstCard = NULL, * temp = NULL, * end = NULL; temp = (card*)malloc(sizeof(card)); temp = leadNode; /*leadNode->next;*/ firstCard = temp; temp->next = NULL; RemoveDrawnCard(leadNode); return firstCard;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started