⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo_type_cast_4_reinterpret_cast_2.cpp

📁 对于一个初涉VC++的人来书
💻 CPP
字号:

//****************************************************************
// reinterpret_cast操作符存在潜在危险,除非理由充分,否则尽可能不用
//****************************************************************

# include <iostream.h>

# include <iostream.h>

void main()
{
	int i=100;
	cout<<"i="<<i<<endl;

	int *pi=&i;
	cout<<"*pi="<<*pi<<endl;

	float *pf=reinterpret_cast<float *>(pi);
	cout<<"*pf="<<*pf<<endl;

	cout<<endl;

	char *ps="This is a string";
	cout<<ps<<endl;

	int j=reinterpret_cast<int>(ps);
	cout<<j<<endl;

	return;
}

/*
i=100
*pi=100
*pf=1.4013e-043

This is a string
4366364
*/

⌨️ 快捷键说明

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