The C programming Language. Please add comments to the codes when you answer. Circles as struct In this question we will represent circles with a
The C programming Language.
Please add comments to the codes when you answer.
Circles as struct
In this question we will represent circles with a struct . A circle has a certain position in a coordinate system and a radius. The position is the center of the circle.
struct circle {
int x, y ;
int radius;
};
typedef struct circle Circle ;
a) Write a function printOut (...) that takes a Circle as in - parameter and print it out to standard output. Note that this function should not load anything from the standard input. Call your function with circle from main. Create the circle as shown here: Example: A circle with position (3,2) and radius 5 print out : Circle at (3,2) with radius 5
b) Write a function named move(...) that takes a pointer to a circle and two integers (dx and dy) as in - parameters and then move the circle (i.e.,the circle the pointer points to) dx units in x - axis and dy units in y - ranks. Please note that this is an auxiliary function: it will not load anything from standard input or print something to standard output. Call your function with circle from question a ) and move it one step in x - axis and two steps in y axes before you print it
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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