32bit/64bit両対応のコードを書いていると,よく printf() で引っかかります."%d"のような"書式"がややこしいからです. というわけで,変数の"型"と"書式"の対応を,表で整理してみました. 型 書式 注意事項 ssize_t %zd size_t %zu intmax_t %jd uintmax_t %ju ptrdiff_t %t signed char %hhd unsigned char %hhu short int %hd unsigned short int %hu int %d unsigned int %u long int %ld unsigned long int %lu long long int %lld unsigned long long int %llu int32_t %PRId32 以下,#include が必要(下記参照) uint3
![32bit/64bit 両対応な printf の書き方 - pyopyopyo - Linuxとかプログラミングの覚え書き -](https://cdn-ak-scissors.b.st-hatena.com/image/square/4139d4448314d153d6114094d733432dace40706/height=288;version=1;width=512/http%3A%2F%2Fecx.images-amazon.com%2Fimages%2FI%2F41KHt9YEIyL.jpg)