使用atoi函数转换。头文件位于stdio.h。
实例参考:
#include
#include
char x[10]={'1','6','2','8','3','7','\0'};
int main(void)
{
int y=atoi(x);
printf("This is a string.\n");
printf("%s\n", x);
printf("This is a number.\n");
printf("%d\n", y);
system("pause");
return 0;
}