Question: Q1) - a) - Prompt the user to enter an int and a float value, store each in an int (name it x) and float

Q1) -

a) - Prompt the user to enter an int and a float value, store each in an int (name it x) and float variable (name it y), respectively.

b) - Declare and assign pointer variables - Declare an int-pointer (name it x_ptr) and a float-pointer (name it y_ptr) and have them point to the two variables in (a) i.e. x and y, respectively.

c) - Accessing the address of variables using pointers - Print the address of each variable - x and y - using pointers declared in (b) i.e. x_ptr and y_ptr.

d) - Accessing the values of variables using pointers - Print the value of x and y using the variable name directly as well as using x_ptr and y_ptr. Check if the values in the two cases are equal.

e) - Checking that changing the variable any of the two ways leads to same result - Increment x directly and print x again using both ways as in (d). Check if they match.

f) - Increment y by accessing it using y_ptr (do not increment y directly). Print the value of y using both methods in (d). Check if they match.

C++ Visual studio

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!