#include <iostream>
#include <string>
using namespace std;
void main()
{
int a,b;
int *p1,*p2;
// void exchanged (int *t1,int *t2);
a=1,b=2;
p1=&a,p2=&b;
cout<<"a="<<a<<" , "<<"b="<<b<<" , "<<endl;
cout<<"a="<<&a<<" , "<<"&b="<<&b<<" , "<<endl<<"\n";
cout<<"*p1="<<*p1<<" , "<<"*p2="<<*p2<<" , "<<endl; //pointer 's value
cout<<"p1="<<p1<<" , "<<"p2="<<p2<<" , "<<endl<<"\n"; //pointer 's point the a&b 's add
int *exchange;
exchange=p1,p1=p2,p2=exchange;
cout<<"all things has exchanged by pointer."<<endl<<"\n";
cout<<"a="<<a<<" , "<<"b="<<b<<" , "<<endl;
cout<<"a="<<&a<<" , "<<"&b="<<&b<<" , "<<endl<<"\n";
cout<<"*p1="<<*p1<<" , "<<"*p2="<<*p2<<" , "<<endl; //pointer 's value
cout<<"p1="<<p1<<" , "<<"p2="<<p2<<" , "<<endl<<"\n"; //pointer 's point the a&b 's add
p1+=1;
cout<<"p1="<<p1<<" , "<<"p2="<<p2<<" , "<<endl; //pointer 's point the a&b 's add
cout<<"p1="<<p1+1<<" , "<<"p2="<<p2<<" , "<<endl; //pointer 's point the a&b 's add
cout<<"p1="<<p1+2<<" , "<<"p2="<<p2<<" , "<<endl<<"\n"; //pointer 's point the a&b 's add
cout<<"*p1="<<*p1<<" , "<<"*p2="<<*p2<<" , "<<endl; //pointer 's value
cout<<"p1="<<p1<<" , "<<"p2="<<p2<<" , "<<endl<<"\n"; //pointer 's point the a&b 's add
int * pt = (int*)0x0012FF7C; //operation of RAM address
*pt = 99;
cout<<"PT = "<<*pt<<endl;
cout<<"PT = "<<pt<<endl;
/* float * p = (float*)0x0012febc;
*p = 0.5; */
cout<<"*p1="<<*p1<<" , "<<"*p2="<<*p2<<" , "<<endl; //pointer 's value
// return 0;
}
/*void exchanged (int *t1,int *t2)
{
int *exchange;
exchange=t1,t1=t2,t2=exchange;
}*/