Question: For each of the following, write a single statement that performs the specified task. Assume that floating-point variables number1 and number2 have been declared and

For each of the following, write a single statement that performs the specified task. Assume that floating-point variables number1 and number2 have been declared and that number1 has been initialized to 7.3.

  1. Declare the variable fPtr to be a pointer to an object of type double and initialize the pointer to nullptr.
  2. Assign the address of variable number1 to pointer variable fPtr.
  3. Display the value of the object pointed to by fPtr.
  4. Assign the value of the object pointed to by fPtr to variable number2.
  5. Display the value of number2.
  6. Display the address of number1.
  7. Display the address stored in fPtr. Is the address displayed the same as that of number1?
  8. Display the address of the pointer fPtr.
  9. Store the sum of number1 and number2 to the location pointed to by fPtr.
  10. Declare the variable fPtrTemp to be a pointer to an object of type double and initialize it fPtr.

 

Step by Step Solution

3.37 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 double fPtr nullptr Declares a pointer variable fPtr to an object of type double and initiali... View full answer

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 Algorithms Questions!