C 库函数 int atoi(const char *str) 把参数 str 所指向的字符串转换为一个整数(类型为 int 型)
函数原型:int atoi(const char *str);
头文件:#include <stdlib.h>
//以下程序输出结果为 1
#define _CRT_SECURE_NO_WARNINGS
#include <stdlib.h>
#include <stdio.h>
int main()
{
char a[] = "-100";
char b[] = "101";
int c;
c = atoi(a) + atoi(b);
printf("c = %d\n", c);
return 0;
}