Reputation: 57
When I try to run this code
#include<stdio.h> int main(){ int a,b,i; scanf("%d %d", &a, &b); printf("sum is %d\n", a+b); return 0; }
it cannot compile and shows this message bellow
main.c:1:19: warning: extra tokens at end of #include directive [enabled by default]
Upvotes: 0
Views: 6073
Reputation: 1082
Directives must be separate and one below the other. On the other hand, in this code the variable i is unnecessary.
#include<stdio.h>
int main(){
int a,b;
scanf("%d %d", &a, &b);
printf("sum is %d\n", a+b);
return 0;
}
Upvotes: 1
Reputation: 867
Your #include
directive should have a space after it, and int main()
should be on a separate line from the include directive.
Upvotes: 0