Ubuntu下int转字符串
更新:HHH   时间:2023-1-7


# include <stdio.h>
# include <stdlib.h>
void main (void)
{
int num = 100;
char str[25];
sprintf(str,"%d",num);
printf("The number 'num' is %d and the string 'str' is %s. \n" ,num, str);
}

在Linux系统中并不支持itoa()和ltoa(),它们并不是C的标准库函数,只能在windows下使用。

● itoa():将整型值转换为字符串。
● ltoa():将长整型值转换为字符串。

返回编程语言教程...