Q:

Predict the output of following C++ program

0

 

//Problems for pointers in c++



#include

using namespace std; int main()

{

int *xp1,*xp2=NULL;

xp1=new int(50);

int x=*xp1;

xp2=new int(100);

cout<<*xp2<<endl;

cout<<*xp2+*xp1<<endl;

*xp1=2000;

cout<<*xp2+*xp1<<endl

; delete xp1;

cout<<*xp1<<endl;

}



All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Output:

100

150

2100

0

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now