#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main(void)
{
int a,b,sub,i,count=0;char buffer[20],w[20];
scanf("%d",&a);
scanf("%d",&b);
sub=a-b;
if(sub>0)
{
scanf("%s",w); /*wrong answer*/
itoa(sub,buffer,10);
int l=strlen(buffer);
for(i=0;i<l;i++)
{
if(w[i]==buffer[i])
count++;
}
((count==l || count==l-1) && w[0]!='0') ? printf("accepted") : printf("Not accepted");
}
else printf("Sub operation returned negative value");
}
The output of the compiler is
prog.c:4:6: warning: return type of 'main' is not 'int' [-Wmain]
void main(void)
^
prog.c: In function 'main':
prog.c:13:1: warning: implicit declaration of function 'itoa' [-Wimplicit-function-declaration]
itoa(sub,buffer,10);
^
/home/HCDVgj/ccHBnrc7.o: In function `main':
prog.c:(.text.startup+0x61): undefined reference to `itoa'
collect2: error: ld returned 1 exit status
I did not use any long int variables but i still get ld return 1 exists. how to debug these errors