您的位置:首页 > 编程语言 > C语言/C++

0710C++基本数据类型之间的转换

2017-07-10 00:45 591 查看
#include<iostream>

using namespace std;

int main()

{
int a = 1.2;//自动转换
int b = static_cast<int>(1.6);//显示转换
int c = (int)2.5;
//C风格
int *ptr1 = nullptr;
char *ptr2 =reinterpret_cast<char*>(ptr1);//CPP风格
const int a = 7;
system("pause");
return 0;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息