Thursday, 22 August 2013

Extremely simple C program won't compile in gcc compiler

Extremely simple C program won't compile in gcc compiler

main()
{
char a,b;
printf("will i get the job:");
scanf("%c",&a);
printf("%c",a);
printf("We did it");
}
i saved the file as Hope.c when i try to compile the code above in the gcc
compiler i get the following error: Hope.c:In function 'main':
Hope.c:4:2:warning:incompatible implicit declaration of built-in function
'printf' [enabled by default]
Hope.c:5:2:warning:incompatible implicit declaration of built-in function
scanf[enabled by default]
this error message occurs wherever i use printf or scanf. even in a simple
helloworld program i'm sort of a newbie in programming. Is there sth wrong
with my code or is it the compiler?

No comments:

Post a Comment