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

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 Databases Questions!