签字/ unsigned char型的区别 [英] Difference between signed / unsigned char
问题描述
所以我知道有符号和无符号整数之间的区别在于,一个位用于表示如果该号码是否积极或消极,但这是如何应用到一个char?一个角色怎么能是积极还是消极的?
So I know that the difference between a signed and unsigned int is that a bit is used to signify if the number if positive or negative, but how does this apply to a char? How can a character be positive or negative?
推荐答案
有在C语言中没有专门的字符类型。 字符
是一个整数类型,相同的(在这方面)为 INT
,短
和其他整数类型。 字符
恰好是最小的整数类型。因此,就像任何其他整数类型,它可以带符号。
There's no dedicated "character type" in C language. char
is an integer type, same (in that regard) as int
, short
and other integer types. char
just happens to be the smallest integer type. So, just like any other integer type, it can be signed or unsigned.
这是事实,(顾名思义)字符
主要是打算用来重新present字符。但在C字符重新$ P $它们的整数codeSpsented,所以没有什么不寻常的,整数类型字符
是用来服务于一个事实,目的。
It is true that (as the name suggests) char
is mostly intended to be used to represent characters. But characters in C are represented by their integer "codes", so there's nothing unusual in the fact that an integer type char
is used to serve that purpose.
一般只字符
和其它整数类型不同的是,普通的字符
通常与<$不是同义词C $ C>符号字符,同时与其他整数类型的签署
修饰符是可选/暗示的保证。
The only general difference between char
and other integer types is that plain char
is generally not synonymous with signed char
, while with other integer types the signed
modifier is optional/implied.
这篇关于签字/ unsigned char型的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!