Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!