今天在学c++遇到一个问题,在地址符转换为int型遇到了问题
//普通变量
int a = 10;
int b = 10;
cout<< "普通变量a的地址为:" << (int)&a<
c++中int为4字节大小,而64位系统指针为8字节,所以会出现错误。
修改为long long 即可
**
修改方式:
**
//普通变量
int a = 10;
int b = 10;
cout<< "普通变量a的地址为:" << (long long)&a< 

![[Error] cast from ‘int*‘ to ‘int‘ loses precision [-fp [Error] cast from ‘int*‘ to ‘int‘ loses precision [-fp](http://www.mshxw.com/aiimages/31/1018770.png)
