/in/foo.c:4:8: error: expected declaration specifiers or '...' before string constant
scanf("%d%d%d",&k,&p,&n);
^~~~~~~~
/in/foo.c:4:17: error: expected declaration specifiers or '...' before '&' token
scanf("%d%d%d",&k,&p,&n);
^
/in/foo.c:4:20: error: expected declaration specifiers or '...' before '&' token
scanf("%d%d%d",&k,&p,&n);
^
/in/foo.c:4:23: error: expected declaration specifiers or '...' before '&' token
scanf("%d%d%d",&k,&p,&n);
^
/in/foo.c:5:2: warning: data definition has no type or storage class
gets(s);
^~~~
/in/foo.c:5:2: warning: type defaults to 'int' in declaration of 'gets' [-Wimplicit-int]
/in/foo.c:5:2: warning: parameter names (without types) in function declaration
/in/foo.c:5:2: error: conflicting types for 'gets'
In file included from /in/foo.c:1:0:
/usr/include/stdio.h:640:14: note: previous declaration of 'gets' was here
extern char *gets (char *__s) __wur __attribute_deprecated__;
^~~~
/in/foo.c:7:10: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
int len=strlen(s);
^~~~~~
/in/foo.c:7:10: warning: incompatible implicit declaration of built-in function 'strlen'
/in/foo.c:7:10: note: include '<string.h>' or provide a declaration of 'strlen'
/in/foo.c:7:10: error: initializer element is not constant
/in/foo.c:9:2: error: expected identifier or '(' before 'for'
for(i=0;i<len;i++)
^~~
/in/foo.c:9:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
for(i=0;i<len;i++)
^
/in/foo.c:9:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
for(i=0;i<len;i++)
^~
/in/foo.c:21:2: error: expected identifier or '(' before 'for'
for(i=0;i<k-1;i++)
^~~
/in/foo.c:21:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
for(i=0;i<k-1;i++)
^
/in/foo.c:21:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
for(i=0;i<k-1;i++)
^~
/in/foo.c:30:9: error: expected declaration specifiers or '...' before string constant
printf("%d",sum);
^~~~
/in/foo.c:30:14: error: expected declaration specifiers or '...' before 'sum'
printf("%d",sum);
^~~
/in/foo.c:31:2: error: expected identifier or '(' before 'return'
return 0;
^~~~~~
/in/foo.c:32:1: error: expected identifier or '(' before '}' token
}
^