int a = 123;
char h = a >> 4;
char l = a & 0x0f;
printf("%d %d\n", h, l);