I have a sample c file called itoa.cpp as below:
#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
",buffer);
return 0;
}
When i compile the above code with the below command:
gcc itoa.cpp -o itoa
i am getting this error:
[root@inhyuvelite1 u02]# gcc itoa.cpp -o itoa
itoa.cpp: In function "int main()":
itoa.cpp:10: error: "itoa" was not declared in this scope
What is wrong in this code? How to get rid of this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…