f0312.cpp
资源名称:c.rar [点击查看]
上传用户:puke2000
上传日期:2022-07-25
资源大小:912k
文件大小:0k
源码类别:
C#编程
开发平台:
Visual C++
- //=====================================
- // f0312.cpp
- // 空间实体的理解
- //=====================================
- #include<iostream>
- using namespace std;
- //-------------------------------------
- int main(){
- float f = 34.5;
- int* ip = reinterpret_cast<int*>(&f);
- cout<<"float address: "<<&f<<"=>"<<f<<endl;
- cout<<" int address: "<<ip<<"=>"<<*ip<<endl;
- *ip = 100;
- cout<<" int: "<<*ip<<endl;
- cout<<"float: "<<f<<endl;
- }//====================================