1 2 3 4 5 6 7 8 9 10
#include <stdio.h> #include <stdlib.h> #include <assert.h> int main() { assert(sizeof(unsigned long) == 4); printf("%ul\n", (unsigned long)strtol("4294967295", NULL, 10)); printf("%ul\n", (unsigned long)strtoll("4294967295", NULL, 10)); return 0; }
1 2
2147483647l 4294967295l