The C compiler must extend the value passed to printf (this is called "promotion"), because printf is a variational function (it can be called with different arguments). For char values, the advanced value is int . Because your char compiler type seems to be signed, the advanced value is a sign extension. In binary format:
char i = 255 // or: 11111111 in binary int promoted_i = -1 // or: 11....11111 (usually, 32 or 64 ones)
In the unsigned case, the sign does not expand:
char u = 255 // or: 11111111 in binary, same as above but with different interpretation unsigned int pu = i // or: 00....0011111111 (8 ones, preceded by the appropriate number of zeroes)
source share