Here is the code:
#include <stdio.h>
#include <stdint.h>
int main()
{
uint8_t ui8 = 0xff;
printf(" %x\n", ui8);
printf(" %x\n", (uint8_t)24);
printf(" %x\n", ui8 << (uint8_t)24);
}
The output is :
ff
18
ff000000
The question is: If I have two uint8_t
variables why the result is "promoted" to a higher rank. If it is not promoted, why do I get such a big number. I test it no MinGW win7-64bit platform