#include #include #include #include #define MAX_LEN 4096 struct card { int num; struct card *next; }; struct card *deck_read(int player_num); void print_deck(struct card *deck); int main(void) { struct card *player1 = deck_read(1); struct card *player2 = deck_read(2); // TODO: Fill in your code here! return 0; } void print_deck(struct card *deck) { while (deck != NULL) { printf("%d -> ", deck->num); deck = deck->next; } printf("X\n"); } // Function to create a deck for the specified player. // Returns a pointer to the top card in the deck. struct card *deck_read(int player_num) { int num; printf("Enter Player %d's deck values:\n", player_num); struct card *head = NULL; struct card *tail = NULL; while (scanf("%d", &num) == 1) { if (num == -1) break; struct card *new_card = malloc(sizeof(struct card)); new_card->num = num; new_card->next = NULL; if (head == NULL) { head = tail = new_card; } else { tail = tail->next = new_card; } } return head; }