Question: Classwork on Pointers Task 1: In function main... Declare a floating point variable named number 1 and initialize its value to 7.3. Declare a second

 Classwork on Pointers Task 1: In function main... Declare a floating

Classwork on Pointers Task 1: In function main... Declare a floating point variable named number 1 and initialize its value to 7.3. Declare a second floating point variable named number2. Declare a pointer to a float named fPtr. 4. Assign the address of number 1 to fPtr. Print the value of the variable pointed to by fPtr by dereferencing fPtr. Assign the value of the variable pointed to by fPtr to number2, again using the dereferenced pointer fPtr. Add 2.0 to number2 and assign the result to the dereferenced pointer fPtr. Print the value now pointed to by fPtr. Print the value of number 1. Print the value of number2. Print the address of number 1. Print the address stored in fPtr. Task 2: Write a program to find the sum and product of two integers, incorporating pointers. Declare four integer variables named a, b, sum, and product. Enter two integers from the keyboard into variables a and b. Write a function to find the sum and product of the two integers. There will be 4 parameters: the two integers and pointers to the sum and product. It should have a prototype like the one below: void calculate (int num 1, int num2, int *sumPtr, int *productPtr); Call the function with a statement like the following: calculate (a, b, &sum, &product); Print the results in function main. If time permits, write a function to read in the two integers. By using pointers the function can return the two numbers through pass by address. The function parameters will be pointers to the two integers. In the call statement the arguments will be the addresses of a and b

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!