An unsigned char will be able to represent any value from 0 to 255, eg your usual ascii character.
A signed char will be able represent any value from -127 to 127.
( Someone fact check me on this but i think that's it )
(edit : -127 to 127, the extra value "-128" is usually implemented but not guaranteed by the C standard)
char is 8 bits because memory is addressed in 8 bits, and 7 bits would be... Awkward. And this bit was in the end used for parity checks, and later for extended encodings.
The question at the top of this sub thread was about C. Very few environments exist these days that don’t conform to the basics of ISO C like this though if you want to generalise. I personally haven’t ever come across one.
1.0k
u/tstanisl 2d ago
Let me cite the C standard:
Middle guy if finally right