Consider the following code:
#include <stdio.h>
#include <inttypes.h>
void main(void)
{
int32_t a = 44;
fprintf(stdout, "%d\n", a);
fprintf(stdout, "%"PRId32"\n", a);
}
When is it better to use %d
and when would it be better to use "%"PRId32
? How do both of those format characters differ? Does this have something to do with how int32_t
is typedeffed on your hardware/machine?