Hi. I'd like to store two numbers on a char. I am able to store the first one but when I try to shift the bits 4 places to the left, I don't get the same number. Here's my code:
What am I doing wrong? Thanks.Code:#include <stdio.h> int main(void) { unsigned char c = 0; c |= 0xF; printf("%d\n", c); /* c = 15 */ c = c << 4; printf("%d\n", c); /* c = 240 */ return 0; }