f0312.cpp

来自「it is a usefull thing」· C++ 代码 · 共 18 行

CPP
18
字号
//=====================================
// 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;
}//====================================

 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?