Question: What is the output of the following code : #include using namespace std; int main () { int firstvalue = 5, secondvalue = 15; int

What is the output of the following code :

#include

using namespace std;

int main ()

{

int firstvalue = 5, secondvalue = 15;

int * p1, * p2;

p1 = &firstvalue;

p2 = &secondvalue;

*p1 = 10;

*p2 = *p1;

p1 = p2;

*p1 = 20;

cout << "firstvalue is " << firstvalue << ' ';

cout << "secondvalue is " << secondvalue << ' ';

return 0;

}

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!