C

Asked • 05/05/19

How to convert integer to string in C?

I tried this example: /* itoa example */ #include <stdio.h> #include <stdlib.h> int main () { int i; char buffer [33]; printf ("Enter a number: "); scanf ("%d",&i); itoa (i,buffer,10); printf ("decimal: %s\\n",buffer); itoa (i,buffer,16); printf ("hexadecimal: %s\\n",buffer); itoa (i,buffer,2); printf ("binary: %s\\n",buffer); return 0; }but the example there doesn't work (it says the function `itoa` doesn't exist).

1 Expert Answer

By:

Patrick B. answered • 05/07/19

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.