convert char array to integer in c code example
Example 1: char array to int c
char myarray[5] = {'-', '1', '2', '3', '\0'};
int i;
sscanf(myarray, "%d", &i);
Example 2: char array to int c
char *string = "-123";
int i = atoi(string);
char myarray[5] = {'-', '1', '2', '3', '\0'};
int i;
sscanf(myarray, "%d", &i);
char *string = "-123";
int i = atoi(string);