strin to int c 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 char to int
int i;
char c = 'A';
i = (int)c;
atoi(str) is unsafe
This is the prefered method:
(int)strtol(str, (char **)NULL, 10)
int i;
char c = 'A';
i = (int)c;