const char *number = "10"; char *end; long int value = strtol(number, &end, 10); if (end == number || *end != '\0' || errno == ERANGE) printf("Not a number"); else printf("Value: %ld", value);