函数名: atoi
功 能: 把字符串转换成长整型数
用 法: #include <stdlib.h>
int atoi(const char *nptr);
程序例:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int n;
char *str = "1234";
n = atoi(str);
printf("string = %s integer = %d\n", str, n);
return 0;
}
运行结果是:
string =1234 integer=1234
温馨提示:答案为网友推荐,仅供参考