I've been told that whenever you work with bytes, you should declare your variables as unsigned chars. In Windows' data types, BYTE is declared as an unsigned char.
My questions:
Why?
Unsigned is a representation of integers from 0 to 255 and signed 128 to -127.
If that's the case, then how is EOF in binaries (-1) caught?
EOF is declared in stdio.h as a -1 #define macro.
charissignedorunsigned. Also,EOFis anintand not achar. If you assignEOFto acharand compare it to theintvalueEOFthey will not match, because the compiler will extend thecharto0x000000ffwhich is not the same as theintvalue0xffffffff(using the normal two's complement value of-1). - Some programmer dude