C语言 int/float/double 数值转成字符串的方法或者函数
C语言 int/float/double 数值转成字符串的方法或者函数
日期:2016-01-15 05:34:33 人气:1
对于int型,可以调用函数itoa。
char*itoa(int value,char*string,int radix);
功能为将任意类型的数字转换为字符串。
int value 被转换的整数,char *string 转换后储存的字符数组,int radix 转换进制数,如2,8,10,16 进制等。
float和double类型没有特定的转换函数。
不过不论是float, double还是int,都可以通过sprintf函数进行转换。
sprintf类似于printf,都是按照