Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!