5
down vote
Your code aptly demonstrates Undefined Behavior. Note that in case of variadic arguments no type checking is done for parameters. This is when an explicit cast becomes necessary. In fact the following should therefore be used:
printf("lld=%lld, ld=%ld, u=%u\n",
(unsignedlonglong)temp,
(unsignedlong)temp,
(unsignedint)temp);
As an aside remember the specifier for size_t
is z
. So:
printf("zd=%zd\n", temp);