1. atoi
int atoi( const char* str ) : 把参数 str 所指向的字符串转换为一个整数(类型为 int 型)
#include <stdio.h>
#include <string.h> // strcpy
#include <stdlib.h> // atoi
int main() {
int val;
char str[20];
strcpy( str, "98993489" );
val = atoi( str );
printf("The value is %d, Its double is %d\n", val, val*2 );
strcpy( str, "LeetCode" );
val = atoi( str );
printf("The value is %d, Its double is %d\n", val, val*2 );
return 0;
}
2. itoa
char* itoa( int value, char* string, i