Question: Write a program in C++ that: Prompts the user to input the value of an integer. Store that input into an int called myVar Create

Write a program in C++ that:

Prompts the user to input the value of an integer.

Store that input into an "int" called "myVar"

Create a pointer, "iptr" and store the address of "myVar" in "iptr"

Print out the value of the integer "myVar", the address of "myVar" (stored in iptr) and the value of the integer stored at the address that "iptr" is pointing to.

Create an integer array, "myArray" of size "myVar" and fill it with integers from 1 to "myVar"

Print out the values in "myArray"

Create a pointer to "myArray" called "ptrToMyArray"

Print out the values in "myArray" using "ptrToMyArray" to access each value.

Make sure that your program properly deletes everything and frees memory upon exit.

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!