C printf() Portable Format

inttypes.h: Integer Type conversions
inttypes.h: Integer Type conversions

unsigned int var = 12;
printf("hello %u world %x", var, var);     /* "hello 12 world c" */
uint32_t var = 12;
printf("hello %" PRIu32 " world %" PRIx32, var, var);     /* "hello 12 world c" */

How to print uint32_t and uint16_t variables value
warning of printf format not suitable for a variable of type uint32_t
Compiler warning about printf() long unsigned int and uint32_t

Leave a Reply

Your email address will not be published. Required fields are marked *