1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include <stdio.h> #include <stdlib.h> int main() { char str[30] = "0128912"; char *ptr; long ret; ret = strtol(str, &ptr, 0); if (ptr != str + 0) { puts("Invalid numeric literal"); } else { printf("\n%s in decimal is %ld\n", ret); } return(0); }
1
Invalid numeric literal