Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am currently learning about pointers in C programming. I need to make a program with two functions - one which asks the user for

I am currently learning about pointers in C programming. I need to make a program with two functions - one which asks the user for two numbers- and one which calculates the sum and product of those two numbers. I need help in making the second function. The second function will use pointers to calculate the sum and product and it will be called "calculateData". I need help using pointers to calculate the sum and product. Here is my code so far-

#include

void askData (float *n1 , float *n2);

int main(void) { float num1, num2 ,sum, product;

askData (&num1 , &num2);

printf(" %f , %f", num1,num2);

return 0; }

void askData (float *n1 , float *n2) { float num1, num2; printf("Enter a number:\t"); scanf("%f", &num1);

printf("Enter a number:\t"); scanf("%f", &num2);

*n1 = num1; *n2 = num2;

}

Please explain your code for the second function (which variables you called, why you called them etc.)

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

Step: 3

blur-text-image

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

Understanding Oracle APEX 5 Application Development

Authors: Edward Sciore

2nd Edition

1484209893, 9781484209899

More Books

Students also viewed these Databases questions

Question

How would you rank the others?

Answered: 1 week ago

Question

4-1. What is meant by the term you attitude? [LO-1]

Answered: 1 week ago