查了一下k&r:
char a single byte, capable of holding one character in the local character set
The qualifier signed or unsigned may be applied to char or any integer. unsigned numbers are always positive or zero, and obey the laws of arithmetic modulo 2n, where n is the number of bits in the type. So, for instance, if chars are 8 bits, unsigned char variables have values between 0 and 255, while signed chars have values between -128 and 127 (in a two's complement machine.) Whether plain chars are signed or unsigned is machine-dependent, but printable characters are always positive.
【 在 ilovecpp 的大作中提到: 】
: 考虑到int全部默认signed,唯独char不同。大概是设计C语言时,各种cpu都能直接操作有符号word,而存在cpu(或者设计者以为存在cpu)只能操作无符号byte,有符号byte需要软件模拟。
: :
--
FROM 216.240.30.*