View Code of Problem 1

int a,b;
scanf("%d,%d",&a,&b);
int c;
c=a+b;
return c;
/*
Main.c:2:7: error: expected declaration specifiers or '...' before string constant
 scanf("%d,%d",&a,&b);
       ^~~~~~~
Main.c:2:15: error: expected declaration specifiers or '...' before '&' token
 scanf("%d,%d",&a,&b);
               ^
Main.c:2:18: error: expected declaration specifiers or '...' before '&' token
 scanf("%d,%d",&a,&b);
                  ^
Main.c:4:1: warning: data definition has no type or storage class
 c=a+b;
 ^
Main.c:4:1: warning: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
Main.c:4:3: error: initializer element is not constant
 c=a+b;
   ^
Main.c:5:1: error: expected identifier or '(' before 'return'
 return c;
 ^~~~~~
*/

Double click to view unformatted code.


Back to problem 1