C++
Posted: Sat Jan 24, 2009 12:26 am
Hi,
I have just started C++
i have two pointeers *p1 and *p2.
int x,y;
int *p1,*p2;
p1=&x;
p2=&y;
*p1=100;
*p2=*p1;
p1=p2;
*p1=20;
When i run the program i get x =100 and y = 20..
I don't understand it..
both x and y need to have the value of 20.. isn't it so?
I have just started C++
i have two pointeers *p1 and *p2.
int x,y;
int *p1,*p2;
p1=&x;
p2=&y;
*p1=100;
*p2=*p1;
p1=p2;
*p1=20;
When i run the program i get x =100 and y = 20..
I don't understand it..
both x and y need to have the value of 20.. isn't it so?