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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started