if you have have variable a and b AND pass the address of variable a to b, then b will going to have the address of a. what happens when you are passing an address to other variable?? is there any significance??
int b = 999;
int *a = &b; //a save the address of b(a point to b)
int * c = &b;//c save the address of b(c point to b)
cout<<b<<endl;
*a = 777;
cout<<b<<endl;
*c = 888;
cout<<c<<endl;
int d = 333;
a = &d;(a point to d)
cout<<d<<endl;
cout<<*a<<endl;
read some books(I would recommend c++ primer or c++ for programmers)
and write the code by yourself and you will know how and why
the most important thing of pointer is
"you have to know where are your pointer point to"(just my opinion)
Lines 5 and 7 are really dangerous. I don't think you intended to, but you are simply changing the pointers to point to random memory, not actually changing what is being pointed to.