Pointer
使用
取地址和取地址指向的数据
#include<iotream>
#include<string>
using namespace std;
公寓大楼 内存卡
房间 内存空间 内存地址(房间号)
int main()
{
int a=324;
int b=100;
string str="sdluxncjdnchsdvhjcbsnxndjbj";
cout<<str<<endl;
//指针可以访问变量的内存地址
//指针就是用来存储某个变量的内存地址的
//int* pA;//int * pA;int *pA;
//pA = &a;
int* pA=&
cout<<pA<<endl;
pA=&b;
cout<<pA<<endl;
cout<<*pA<<endl;//*取得后面的(指针)内存地址所指向的数据(所存储的数据)
*pA=300//b=300
cout<<b<<":"<<*pA<<":"<<pA<<endl;
string s;
cin>>s;
return 0;
}
//&取某个变量的地址;*取某个变量的数据