Question: The language used here is C++ Develop a C program that declares a double x, an int y, and a float z. Declare three pointers

The language used here is C++

Develop a C program that declares a double x, an int y, and a float z. Declare three pointers that point to each of the three variables.

a) Initialize x, y, z to values 1.0, 2, and 3.0, respectively, using the pointer notation.

b) Print the values of x, y, z, and x+y+z using pointer notation.

c) Print the addresses of x, y, z.

d) Print the addresses of the three pointers.

Use the format string "%p" to print the addresses in hexadecimal notation (base 16). You should see addresses that look something like this: "0x7fff5242eacc".

Sample Output:

Input: 1 2 3

Output: 1.0, 2, 3.0, 6.0

0x7fff5242ead0, 0x7fff5242eacc, 0x7fff5242eac8 (these numbers will not be exact to this output)

0x7fff5242eac0, 0x7fff5242eab8, 0x7fff5242eab0 (these numbers will not be exact to this output)

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