Possible Duplicate:
Print an int in binary representation using C
How would I print the byte representations of a short int, and double in C.
As in lets say I have a function display_shortInt, how would I make it print the byte representation of a short int? I’m new to C, thanks you!
What about this?
That will print the bytes that form the value, in hexadecimal, two characters per byte.
For example, in a little-endian machine,
print_short(42)will print(2A00). In a big-endian machine it will be(002A).