Convert an integer or a float to a string
Does there exist any other function which can be used to convert an integer or a float to a string?
Some implementations provide a nonstandard function called itoa(), which converts an integer to string.
char *itoa(int value, char *string, int radix);
DESCRIPTION - The itoa() function constructs a string representation of an integer.
value: Is the integer to be converted to string representation.
string: Points to the buffer that is to hold resulting string. The resulting string may be as long as seventeen bytes.
radix: Is the base of the number; must be in the range 2 - 36.
Another portable solution exists. One can use sprintf():
char s[SOME_CONST]; int i = 10; float f = 10.20; sprintf ( s, "%d %f\n", i, f );
2007-02-26, 8083👍, 0💬
How do you override a defined macro? You can use the #undef preprocessor directive to undefine (over...
How can I check for HTML errors? HTML validators check HTML documents against a formal definition of...
How To Retrieve the Count of Updated Rows? - Oracle DBA FAQ - Working with Database Objects in PL/SQ...
How To Control Vertical Alignment? - XHTML 1.0 Tutorials - Understanding Tables and Table Cells By d...
How To View All Columns in an Existing Table? - Oracle DBA FAQ - Managing Oracle Database Tables If ...