C
x
20
1
int main()2
{3
char str[100][100];4
int i=0;5
while(1){6
7
scanf("%[^\n]%*c", str[i]);8
9
if(strcmp(str[i],"end")==0) break;10
else{11
i++;12
}13
14
15
}16
for(int j=0;j<i;j++)17
printf("%s\n", str[j]);18
19
return 0;20
}$ gcc prog.c -Wall -Wextra -std=c99 -pedantic
Stdin
8 6 adsasda das dasd dddd asd sda dasdasendStart
prog.c: In function 'main':
prog.c:7:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
7 | scanf("%[^\n]%*c", str[i]);
| ^~~~~
prog.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main()
prog.c:7:5: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
7 | scanf("%[^\n]%*c", str[i]);
| ^~~~~
prog.c:7:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:9:8: warning: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration]
9 | if(strcmp(str[i],"end")==0) break;
| ^~~~~~
prog.c:1:1: note: include '<string.h>' or provide a declaration of 'strcmp'
+++ |+#include <string.h>
1 | int main()
prog.c:17:5: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
17 | printf("%s\n", str[j]);
| ^~~~~~
prog.c:17:5: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:17:5: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
prog.c:17:5: note: include '<stdio.h>' or provide a declaration of 'printf'
8 6
adsasda das dasd
dddd
asd sda
dasdas
0
Finish