[Main]
Title=How can I display a number variable on the screen (like an int)?

[Top]
<TABLE CELLPADDING="4"><TR><TD VALIGN="TOP"><B>Q:</B></TD><TD>
How can I convert an integer or a float to a string?
</TD></TR><TR><TD VALIGN="TOP"><B>A:</B></TD><TD>
It's easy. Use
<A HREF="$$LINK(stdio.h/sprintf)">sprintf</A>. For example:
<PRE>char string1[50];
char string2[50];
short int var1;
float var2;
...
sprintf (string1, "%d", var1);
sprintf (string2, "%f", var2);
</PRE>
That's why there is no need for functions like <B>itoa</B> and <B>ftoa</B>
in opposite to <A HREF="$$LINK(stdlib.h/atoi)">atoi</A> and <A HREF="$$LINK(timath.h/atof)">atof</A>.
</TD></TR></TABLE>
