itoa
is not part of ANSI-C. Nor is it part of any POSIX standard. On Linux + gcc, for instance, itoa
is not present in stdlib.h
. Including stdlib.h
(as suggested at one stage in the comments) on such platforms will not fix your problem:
$ grep -w -R itoa /usr/include
$
nope - it's not there!
Don't use itoa
. Instead, use something portable, for instance snprintf
or (if you are fine with gcc only) asnprintf
.
If you insist on using itoa
, then perhaps #include <stdlib.h>
will help; if so the answer to your question would be that on that platform it's part of the standard C library, and not a library you need to download. If it doesn't work, then it's not part of the standard C library, and you should use a portable solution instead.
Also, be wary of itoa
anyway. From a random man page on the internet:
itoa
does not allocate new memory space for the string, but rather returns a pointer to the internal buffer where the conversion takes place
itoa
is not reentrant (therefore not thread safe), and solutions like the first one here cannot be either whilst maintaining the same API. A better solution is the second answer here: Where is the itoa function in Linux?