Question
C language only please.... In the following, a memory for a deck of cards is created in C step by step. Cards with values from
C language only please....
In the following, a memory for a deck of cards is created in C step by step. Cards with values from 2 to 10, jack, queen, king and ace in the suits clubs, spades, hearts and diamonds are used for this. In this task, the modularization of C files is used. In the Moodle course you will find a main.c and a Bonus.h. You must also create a Bonus.c. No changes may be made to the other files. Some functions are declared in Bonus.h. You should now define this in the Bonus.c. In the main program you can step by step comment the specified blocks for testing.
a) (3 points) Start with the printCard() function. This should output the handed over card into the terminal. The output must look like this: 1 heart jack or 1 club 6 Note: It can happen that a NULL pointer is passed to the function. In this case, the function should simply do nothing.
b) (2 points) Now implement the function printCardStack(). This should issue a whole stack of cards. The deal must look like this: 1 2 3 4 5 Card 1: Club King Card 2: Spade 7 Card 3: Club 9 Card 4: Heart Jack Card 5: Heart 8 Note: Use the function from part b).
c) (3 points) You already know the helper function swapCards(). Now these two handed over cards should swap. To do this, both attributes must be exchanged individually! Note: It may happen that one or two NULL pointers are passed to the function. In this case, the function should simply do nothing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started