Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions

Question

4. Criticallv evaluate the motives of P & G. V.

Answered: 1 week ago