I'm noticing that cout << hex
is giving me strange results, and I cannot find anywhere that answers why. What I am doing is simply assigning some values to both a uint8_t
and uint16_t
and then attempting to write them to stdout. When I run this:
uint8_t a = 0xab;
uint16_t b = 0x24de;
cout << hex << a << endl;
cout << hex << b << endl;
That I get the result:
$./a.out
24de
$
with no value displayed for the uint8_t. What could be causing this? I didn't think there wouldn't be a cout implementation for one type for not the other.