unsigned char x = 93;
unsigned char a = x << 4;
printf("a = %d\n", a);
I do understand how bit operators work but I don't understand the binary representation of x.
How is a = 208?
93 = 01011101
Shift that left 4 bits and it leaves the following (only 8 bits in your result):
11010000 = 208
x = 93 = 0x5D = 0101 1101
<< 4 = 1101 0000
1101 0000 in decimal is 208.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With