Monday, September 25, 2006

Unexpected Error

printf("%d %d", 1ll, 1ll);

This will not output the expected result. A 64-bit integer will not cooperate with a %d argument.

So, instead

printf("%d %d", (int)1ll, (int)1ll);

or

printf("%I64d %I64d", 1ll, 1ll);

or

printf("%lld %lld", 1ll, 1ll);

should be used.

No comments:

Post a Comment

Please post your comment here. ;)