| MushroomWobbit (22) | |||
so i got this code.
and i expect it to print AB but instead i get FFFFFFAB if i just say 0xA in the code i get A as output, but if i use AB why does it get padded? | |||
|
|
|||
| coder777 (1611) | |
|
char is 8 bit signed. So everything 0x80+ (128+) which has the highest bit set is interpreted as a negative value. printf converts 'H' to int (32 bit). 0xab = -85 -> int 0xFFFFFFAB. 0xA < 0x80 hence not negative. | |
|
|
|