C语言unsigned char、char与int之间的转换
C语言unsigned char、char与int之间的转换
2016年10月23日 18:40:50 bladeandmaster88 阅读数:11347更多
个人分类: c语言基础
先来看一道题:
char c1 =-1;
cout<< (int)c1 << endl;
输出为:-1
unsigned char c2 = -1;
cout << (
int)c2 << endl;
输出为:255
2016年10月23日 18:40:50 bladeandmaster88 阅读数:11347更多
个人分类: c语言基础
先来看一道题:
char c1 =-1;
cout<< (int)c1 << endl;
输出为:-1
unsigned char c2 = -1;
cout << (
int)c2 << endl;
输出为:255