Question: Trace the following program and show its output on the space below: Assume that a, b, p1, and p2 are in the memory locations/address 0018FB46,
Trace the following program and show its output on the space below: Assume that a, b, p1, and p2 are in the memory locations/address 0018FB46, 0018FE45, 0018FD3A, and 0018FF37, respectively.
a b p1 p2
0018FB46 0018FE45 0018FD3A 0018FF37
#include
using namespace std;
int main( ){
int a=8, b=9;
int *p1, *p2;
p1 = &b;
cout< p2=new int(4); cout<<*p2<<" "< p2=p1; *p1=*p2; cout<<*p2<<" "<<*p1<<" "< p1=&a; cout<<*p1<<" "< return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
