I'm trying to save an integer as a character.
char i = 80;
printf("0x%x", i);
The above code displays 0x50 (1 byte). But if the value is above 128, it prints a 4 byte value.
char i = 130;
printf("0x%x", i); // this prints 0xffffff82
How can I store the integer value as just 1 byte if the value is greater than 128 (print just 82 instead of ffffff82 in second example) ?