I want to get a double byte figure from user input,
but it shows 0000 instead of 4-digit(hex). So, is there any better way to accept double/multiple byte from user input?
I dont know what your gethex function does. In any case, what is
happening might be because the x format specifier is expecing an
int or unsigned (in your case maybe an int32). As a result it is
reading the low/high word depending on the endianess of your
machine, which may not be what you want. You could try to
set data to an int32 type or better yet an unsigned since in this
case, you just want the hex value.
in your code, data1 is declared as int8
so, your instruction of "data1<<8" is probably make the entire byte become zero, as 8 zero shifted in
maybe u can try this