c语言中的ftoa函数的作用以及它的头文件是什么

Python018

c语言中的ftoa函数的作用以及它的头文件是什么,第1张

函数名字理解可能是将浮点数转为字符串。其功能应该与sprintf相类似。但我在TC\VC函数库中均没有找到此函数,只有itoa()() atoi()等等 中国物联网校企联盟技术部

函数需有返回值,或者直接用引用传递

#include <stdio.h>

char ftoa(float i)

char main()

{

char strtemp

float a=3.1415926

strtemp=ftoa(a)

printf("%i\n",strtemp)

}

char ftoa(float i)

{

char str

str=(char)i

return str

}

#include <stdio.h>

void ftoa(float i,char *str)

char main()

{

char strtemp

float a=3.1415926

ftoa(a,&strtemp)

printf("%i\n",strtemp)

}

void ftoa(float i,char *str)

{

*str=(char)i

}