Thread: Problem using itoa

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    85

    Problem using itoa

    Good morning to all!

    I have a program and i'm trying to use itoa but i get the following error :

    Undefined first referenced
    symbol in file
    itoa /var/tmp//ccS9wuQX.o
    ld: fatal: Symbol referencing errors. No output written to a.out
    collect2: ld returned 1 exit status


    My source code is:

    Code:
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    
    int main() {
    
    int counter = 0;
    
    char array[20];
    
    itoa(counter,array,10);
    
    /* counter is the integer value i would like to convert in ASCII */
    /* array is the array where the ascii value is going to be stored */
    /* I'm not sure if 10 is right, as i understood from the manual page of itoa it means decimal */
    
    printf("&#37;s\n",array);
    
    }
    Thanks, in advance!!!



    Which library shall i include in the C program?
    Last edited by g_p; 05-03-2008 at 06:18 AM.

  2. #2
    Registered User
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    217
    sprintf(array, "&#37;i", counter)

    I dont think itoa is standard.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    85
    Yeah, thanks a lot!
    It worked!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Problem with itoa() perhaps?
    By TheSquid in forum C++ Programming
    Replies: 5
    Last Post: 05-08-2006, 02:04 AM