Takeaway 8.15
Use "%d" and "%u" formats to print integer values.
If, on the other hand, you are interested in a bit pattern, use the hexadecimal format over octal. It better corresponds to modern architectures that have 8-bit character types.
Takeaway 8.16
Use the "%x" format to print bit patterns.
Also observe that this format receives unsigned values, which is yet another incentive to only use unsigned types for bit sets. Seeing hexadecimal values and associating the corresponding bit pattern requires training. Table 8.8 has an overview of the digits, the values, and the bit pattern they represent.
For floating-point formats, there is even more choice. If you do not have specific needs, the generic format is ...
Get Modern C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.