Create a new file called pointerBasics.cpp. Write a C++ program in this new file. In this new file, write code that will do the following: Declare an integer variable called myInt and assign the value 15 to it. Declare a pointer variable called myPointer using the dereference operator (*) and assign it to the memory location of myInt using the address-of operator (&) Print the memory location of myInt (remember the address-of operator!) and the value of myPointer. Print the value of myInt and the value pointed to by myPointer (remember the dereference operator!) Change the value of myInt to 10. Print the memory location of myInt (remember the address-of operator!) and the value of myPointer. Print the value of myInt and the value pointed to by myPointer (remember the dereference operator!) Declare and assign values to variables Print to console Change values and print to console Take a screenshot of a sample output

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.5: Case Studies
Problem 8E
icon
Related questions
Question
  1. Create a new file called pointerBasics.cpp. Write a C++ program in this new file. In this new file, write code that will do the following:
    1. Declare an integer variable called myInt and assign the value 15 to it.
    2. Declare a pointer variable called myPointer using the dereference operator (*) and assign it to the memory location of myInt using the address-of operator (&)
    1. Print the memory location of myInt (remember the address-of operator!) and the value of myPointer.
    2. Print the value of myInt and the value pointed to by myPointer (remember the dereference operator!)
    1. Change the value of myInt to 10.
    2. Print the memory location of myInt (remember the address-of operator!) and the value of myPointer.
    3. Print the value of myInt and the value pointed to by myPointer (remember the dereference operator!)
    1. Declare and assign values to variables
    2. Print to console
    3. Change values and print to console

Take a screenshot of a sample output

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning