Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stdlib itoa function

Tags:

c

standards

libc

I searched on internet and saw a lot of code that uses itoa() function & they claimed that this function is in stdlib.h

I'm using 2 versions of GCC right now:

  1. (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4))

  2. (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)

and both of them does not have itoa() function (I compile the program & error: undefined reference to `itoa').

Any ideas? Thanks.

like image 534
user397232 Avatar asked Sep 18 '25 00:09

user397232


1 Answers

itoa() isn't in standard C - snprintf() is the function to use in its place (at least it's probably the simplest change to make).

like image 122
Michael Burr Avatar answered Sep 20 '25 15:09

Michael Burr