Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can You you help me with this homework Using the same code Than This program firstly initializes an object of struct Circle with values and

image text in transcribedimage text in transcribed

Can You you help me with this homework

Using the same code

Than

This program firstly initializes an object of struct Circle with values and then updates those using pointers. The program uses structure notation once and pointer notation another afterwards. \#include \#include \#define MIN 1 \#define MAX 30 struct Circle \{ float xCoord; float yCoord; float radius; \}; /* prototypes */ float getRandomNumber(int min, int max); void printByValue(struct Circle cirObj); void setValue(float *target, float newValue); void printByReference(struct Circle *cirObj); int main(void) \{ / Declare a struct circle and name it circleObject / struct Circle circleObject; /* Fill circleObject's members with random numbers */ circleObject.xCoord = getRandomNumber(MIN, MAX); circleObject.yCoord = getRandomNumber(MIN, MAX); circleObject.radius = getRandomNumber(MIN, MAX); /* Printing values of the circle by calling function print by value */ printByValue(circleObject); /* update values of circle one by one */ setValue(\&circleObject.xCoord, getRandomNumber(MIN, MAX)); setValue(\&circleObject.yCoord, getRandomNumber(MIN, MAX)); 35 setValue(\&circleObject.radius, getRandomNumber(MIN, MAX)); /* Printing values after update by calling function print by reference / printByReference(\&circleObject); Task 1.1: define the function float getRandomNumber(int min, int max); that returns a random number generated within the range min and max. Task1.2: define the function void printByValue(struct Circle cirobj); that prints on the screen values of circle (xCoord, yCoord, and radius). Task 1.3: define the function void setValue(float *target, float newValue); that updates the given variable var with the new value. Use this to update the value of circle object in the activity. For example, call it to update values of xCoord, yCoord, and radius. Task1.4: define the function void printByReference(struct Circle *cirobj); that prints on the screen the values of circle object after using the function in Task1.3 above but with call by reference (pointer of circle)

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_2

Step: 3

blur-text-image_3

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

Define Scientific Management

Answered: 1 week ago

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago