/* Example: convert string to int and check if it's a number in C language */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <stdbool.h> #include <errno.h> void main(void) { 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); }