1. GNU (ISO C99)
size_t x = ...;
printf("%zu\n", x); // prints as unsigned decimal
printf("%zx\n", x); // prints as hex
printf("%zd\n", x); // prints as signed decimal
2. Microsoft Visual C++
size_t x = ...;
printf("%Iu\n", x); // prints as unsigned decimal
3. Others
use %u or %lu