include<挢旗扦渌;stdlib.h>
#include<stdio.h&爿讥旌护gt;
intmain()
{
intnumber=123456;
charstring[25];
itoa(number,string,10);
printf("integer=%dstring=%s\n",number,string);
return0;
}
扩展资料
C语言将char字符串转换成整型数
#include<stdlib.h>
#include<stdio.h>
intmain(void)
{
intn;
char*str="12345.67";
n=atoi(str);
printf("string=%sinteger=%d\n",str,n);
return0;
}