C language convert string to int

‮th‬tps://www.lautturi.com
C language convert string to int
/*
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);
}
Created Time:2017-08-28 15:12:39  Author:lautturi