convert string to int in c with limits code example
Example 1: string to int c
atoi(str) is unsafe
This is the prefered method:
(int)strtol(str, (char **)NULL, 10)
Example 2: c convert char to int
int i = (int)(c - '0');
atoi(str) is unsafe
This is the prefered method:
(int)strtol(str, (char **)NULL, 10)
int i = (int)(c - '0');