Based on the code:
#include <stdio.h> int main(void) { long l1 = +2147024891; long l2 = -2147024891; printf("%+11li = 0x%lx\n", l1, l1); printf("%+11li = 0x%lx\n", l2, l2); return(0); }
Output compiled in 32-bit mode (on MacOS 10.6.2):
+2147024891 = 0x7ff8fffb -2147024891 = 0x80070005
Output compiled in 64-bit mode:
2147024891 = 0x7ff8fffb -2147024891 = 0xffffffff80070005
Since you are not showing us what you wrote, and why you were expecting something else, it is hard to say what might be wrong. However, although relatively unusual, the conversion " %li " was in C89 as well as C99, so this should be correct. More normal conversion specifiers are " %ld " (synonymous with " %li ") and " %lu " (and " %lo " and " %lx ") for unsigned values.
source share