Table of Contents

printf

Cross platform format string

#include <stdint.h>    // for uint64_t
#include <inttypes.h>  // for PRIu64
 
size_t my_variable;
printf("%" PRIu64 "\n", (uint64_t)my_variable);

https://www.cplusplus.com/reference/cinttypes/ https://stackoverflow.com/questions/174612/cross-platform-format-string-for-variables-of-type-size-t/174674#174674

Float padding

The field width includes the decimal point and the fractional portion (and the sign, if it's negative).

Padding negative numbers

Flags: