how to change a number in a string into integer in 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: how to cast string to int in c
use atoi from the stdlib.h
char *string = "hi";
int x = atoi(string);