今天学习一点轻松的内容。
有意思,今天发现我这里写的一篇文章居然没有了,或许是自己根本就没有发上来吧
就补充一下:
两者关系很简单,unsigned对应的数值是0~255,而signed是-128~127
查看msdn的话就可以看到了:
Character values of type unsigned char have a range from 0 to 0xFF hexadecimal. A signed char has range 0x80 to 0x7F. These ranges translate to 0 to 255 decimal, and –128 to +127 decimal, respectively. The /J compiler option changes the default from signed to unsigned.
char 是有或者为无符号的,是要通过设置的
unsigned char 是无符号的,里面全是正数
两者都作为字符用的话是没有区别的,因为现在的字符集有限,但当整数用时有区别,区别就是数值的对应
在c++里可以这么查看一个char定义是signed与否:











