With the larger 64-bit data types, printf
"%" codes needed to be upgraded to include them. Full documentation is available on MSDN but here is a brief overview:
Code | Description |
%d | int , 32-bit integers, on all platforms |
%ld | long int, 32-bit integers, on all (Windows) platforms |
%I32d | \__int32 , 32-bit integers, on all platforms (rarely used) |
%I64d | \__int64 , 64-bit integers, on all platforms |
%Id | intptr_t , 32- or 64-bit integer, depending on the platform |
%Iu | size_t , 32- and 64-bit unsigned integer |
Developers often use %x
or %08x
to print pointers but this is not portable. A better way is to use %p
.