Using the above C++ statements I am trying to create a C++ program that contains five more statements. The first statement makes intPtr point to x by using the address-of operator.  The second statement dereferences intPtr and stores the value 5 into x via indirect addressing. The third statement prints the actual memory address of where the variable x is stored. The fourth prints the contents of intPtr. The fifth prints the contents of x. Show your source code and program output.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.1: Addresses And Pointers
Problem 3E
icon
Related questions
Question
100%

int x;

int* intPtr;

Using the above C++ statements I am trying to create a C++ program that contains five more statements. The first statement makes intPtr point to x by using the address-of operator.  The second statement dereferences intPtr and stores the value 5 into x via indirect addressing. The third statement prints the actual memory address of where the variable x is stored. The fourth prints the contents of intPtr. The fifth prints the contents of x. Show your source code and program output.

Expert Solution
steps

Step by step

Solved in 4 steps with 2 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.
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning