This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

convert number to string


I am trying to convert a number to a string. The C book I have states
that the function is in stdlib.h, For example, the syntax for itoa() is:

        char *itoa(int value, char *string, int radix)

Here is my convtst.c:

#include <stdio.h>
#include <stdlib.h>
main()
{
   char *s[17];
   int x = 1234;
   itoa(x, s, 10);
   printf("%s\n", s);
   return 0;
 }
I compiled the program as:    gcc convtst.c -oconvtst
gcc gave error: undefined reference to atoi

Is there a function to convert float to string, s.a. ftoa()?, in stdlib

Please help.  Thanks.
Tom Tran


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]