Find the answer to your Linux question:
Results 1 to 6 of 6
hi, i am using itoa & when i was compiling the following error msg is coming: implicit declaration of function ‘itoa’ Excercise Excercise.c line 74 1214390285696 2514 help me to ...
  1. #1
    Just Joined!
    Join Date
    Jun 2008
    Posts
    4

    itoa

    hi,

    i am using itoa & when i was compiling the following error msg is coming:

    implicit declaration of function ‘itoa’ Excercise Excercise.c line 74 1214390285696 2514


    help me to solve this problem.........................

  2. #2
    Linux User nalg0rath's Avatar
    Join Date
    Sep 2004
    Location
    Stockholm
    Posts
    303
    You generally get the implicit declaration error when you haven't included the header where the function you're using is defined. Tip: Manpages are useful to find out what headers define the function you need.

    Code:
    # man itoa
    However, the itoa function is not in any C standard and thus not included with all compilers (headers). Generally the function is in stdlib.h, so make sure you include it in the source file:
    Code:
    #include <stdlib.h>

  3. #3
    Just Joined!
    Join Date
    Jun 2008
    Posts
    4

    itoa error

    hi thans,

    i included stdlib.h. but it showing error msg

  4. #4
    Just Joined!
    Join Date
    Dec 2007
    Location
    bangalore
    Posts
    38
    Quote Originally Posted by hai12345 View Post
    hi thans,

    i included stdlib.h. but it showing error msg


    hi,
    i really doubt whether there is a function call like itoa there is atoi in stdlib.h but i dont think itoa is available unless ofcourse itoa is ur own defined function .....!!!!

  5. #5
    Linux User nalg0rath's Avatar
    Join Date
    Sep 2004
    Location
    Stockholm
    Posts
    303
    Quote Originally Posted by robinsonvpanicker View Post
    hi,
    i really doubt whether there is a function call like itoa there is atoi in stdlib.h but i dont think itoa is available unless ofcourse itoa is ur own defined function .....!!!!
    As I said there is an itoa function that sometimes is included in the standard libraries of the compiler - though in most cases it is not (because itoa is not in ANSI C).

    So, if you really want to use itoa (convert int to ASCII) you could write your own function since you obviously use a compiler that follows the standards (which is good).

    PS. When writing your own itoa watch out for memory leaks and buffer overflows.

  6. #6
    Just Joined!
    Join Date
    Dec 2007
    Location
    bangalore
    Posts
    38
    yep, watchout for buffer overflows...which is really important

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...