Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need help with fixing these two functions. This program is for a UNO card game. The function is the discard pile. I'm not

Hi, I need help with fixing these two functions. This program is for a UNO card game. The function is the discard pile. I'm not sure how to add the card to the discard list and change the head of the discard to the new card from the player's hand.(which is a list as well). Right now its not changing the head of the discard list.

Any changes or advice would be appreciated.

void discard_fun(card *handp, card **discardHead, card **discardTail, int input) {

card *target = handp;

card *previous = NULL;

int i;

for (i = 0; i < input; i++) {

previous = target;

target = target->next;

}

previous->next = target->next;

target->next = handp;

handp = target;

previous->value = (target)->value;

strcpy(previous->suit, (target)->suit);

strcpy(previous->action, (target)->action);

(*discardTail)->next = previous;

*discardTail = previous;

(*discardTail)->next = NULL;

}

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions