请注意,上述函数与ANSI标准是不兼容的。能将整数转换为字符串而且与ANSI标准兼容的方法是使用sprintf()函数,
#include<stdio.h>
#include <stdlib.h>
int main ()
{
int num = 123456;
char str[50];
sprintf(str, "%d" , num);
printf ("The number 'num' is %d and the string 'str' is %s. \n" , num, str);
getchar();
return 0;
}

浙公网安备 33010602011771号