Take the 2-minute tour ×  When i was reading K&R, i am confused
in this code:  #include "syscalls.h" int getchar(void)     char
c;   It is said unsigned char used for avoiding the wrong
brought by sign extension in this code. This is the only case i
can think of,and i give this example code:  char c = 0xf0;
//11110000, just make highest bit > 1
printf("%i\n",(int)(unsigned char)c);  Output:  240 //
0...011110000          -16 // 1...111110000  But in fact ascii
is just 0~127 highest bit can not be assigned to 1.Why in K&R
cast char >> unsigned char?  share|improve this question What
makes you think that a char needs to be limited to the ASCII
character set ? –  Paul R May 20 '13 at 13:13 @PaulR Thanks,but
can you teach me how to print and get a wrong output with using
a no cast getchar() :) My PC:Ubuntu13 x64 –  pupu007 May 20 '13
at 14:03 add comment  3 Answers  up vote 3 down vote accepted
ASCII is limited to the range 0..127 but it's not only ASCII
that can be read by read - in K&R, it could get the entire