I have an unsigned int value in
u_int_variable = 43981; // This is equal to ABCD in HEX
I can print this to console in hex as ABCD using
printf("Value in Hex is %X", u_int_variable);
// Output : Value in Hex is ABCD
How can I convert and separate this such that
unsigned char uhex, lhex;
uhex = 0xAB; and lhex = 0xCD;
Or, to be absolutely safe for >32 bit unsigned ints: