영어로 읽는 코딩

13 [C] singed vs. unsigned

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.

 

[The C Programming Language (second edition, Prentice Hall) by Brian W. Kernighan and Dennis M. RitchieS] p. 36

댓글

댓글 본문
버전 관리
Yoo Moon Il
현재 버전
선택 버전
graphittie 자세히 보기