I am guessing that itoa may not be present in the standard C library you are using. You could try specifying the flag -fpermissive to see if the code works.
–
GWWMar 25 '11 at 4:46

1

There's no such function as itoa in the "official" standard library. Apparently the standard library you are using does not provide itoa. Your -pedantic and -ansi flags will not help anything. Quite the opposite, they can actually make things worse by hiding non-standard functions (I don't know whether they really do that). Try compiling without them.
–
AnTMar 25 '11 at 4:49

You need a bigger buffer to handle the negative sign.
–
RocketRoyFeb 1 '14 at 3:22

1

@RocketRoy it was actually simply an example. The value 20 in the example fits just fine in a char[10] and that's the buffer size the OP was using. But yes, a signed 32 bit int would require char[12] to handle the sign and \0
–
Brian RoachFeb 1 '14 at 5:21

1

@BrianRoach while you are perfectly correct, for the sake of people who like to copy paste I have changed the size of the buffer in the example.
–
chacham15Feb 1 '14 at 7:27

all well and good until you need a base conversion...
–
Dave DurbinMar 10 at 23:27

This here tells you that during the compilation phase itoa is unknown:

warning: implicit declaration of
'itoa'

so if this function is present on your system you are missing a header file that declares it. The compiler then supposes that it is a function that takes an unspecific number of arguments and returns an int.

This message from the loader phase

undefined reference to '_itoa'

explains that also the loader doesn't find such a function in any of the libraries he knows of.

So you should perhaps follow Brian's advice to replace itoa by a standard function.