错误解释

CompileError!

编译信息

main.c: In function \xe2\x80\x98main\xe2\x80\x99:\nmain.c:6:5: warning: implicit declaration of function \xe2\x80\x98fgets\xe2\x80\x99 [-Wimplicit-function-declaration]\n 6 | fgets(s,sizeof(s),stdin);\n | ^~~~~\nmain.c:6:23: error: \xe2\x80\x98stdin\xe2\x80\x99 undeclared (first use in this function)\n 6 | fgets(s,sizeof(s),stdin);\n | ^~~~~\nmain.c:3:1: note: \xe2\x80\x98stdin\xe2\x80\x99 is defined in header \xe2\x80\x98<stdio.h>\xe2\x80\x99; did you forget to \xe2\x80\x98#include <stdio.h>\xe2\x80\x99?\n 2 | #include <string.h>\n +++ |+#include <stdio.h>\n 3 | int main()\nmain.c:6:23: note: each undeclared identifier is reported only once for each function it appears in\n 6 | fgets(s,sizeof(s),stdin);\n | ^~~~~\nmain.c:8:22: warning: comparison between pointer and integer\n 8 | if (n>0 && s[n-1]=="\\n") {\n | ^~\nmain.c:8:22: warning: comparison with string literal results in unspecified behavior [-Waddress]\nmain.c:9:15: warning: assignment to \xe2\x80\x98char\xe2\x80\x99 from \xe2\x80\x98char *\xe2\x80\x99 makes integer from pointer without a cast [-Wint-conversion]\n 9 | s[n-1]="\\0";\n | ^\nmain.c:13:16: warning: comparison between pointer and integer\n 13 | while (s[i]!="\\0") {\n | ^~\nmain.c:13:16: warning: comparison with string literal results in unspecified behavior [-Waddress]\nmain.c:14:20: warning: comparison between pointer and integer\n 14 | while (s[i]==" ") {\n | ^~\nmain.c:14:20: warning: comparison with string literal results in unspecified behavior [-Waddress]\nmain.c:17:17: warning: comparison between pointer and integer\n 17 | if (s[i]!="\\0") {\n | ^~\nmain.c:17:17: warning: comparison with string literal results in unspecified behavior [-Waddress]\nmain.c:19:24: warning: comparison between pointer and integer\n 19 | while (s[i]!=" " && s[i]!="\\0") {\n | ^~\nmain.c:19:24: warning: comparison with string literal results in unspecified behavior [-Waddress]\nmain.c:19:37: warning: comparison between pointer and integer\n 19 | while (s[i]!=" " && s[i]!="\\0") {\n | ^~\nmain.c:19:37: warning: comparison with string literal results in unspecified behavior [-Waddress]\nmain.c:24:5: warning: implicit declaration of function \xe2\x80\x98printf\xe2\x80\x99 [-Wimplicit-function-declaration]\n 24 | printf("%d\\n",count);\n | ^~~~~~\nmain.c:24:5: note: include \xe2\x80\x98<stdio.h>\xe2\x80\x99 or provide a declaration of \xe2\x80\x98printf\xe2\x80\x99\nmain.c:24:5: warning: incompatible implicit declaration of built-in function \xe2\x80\x98printf\xe2\x80\x99 [-Wbuiltin-declaration-mismatch]\nmain.c:24:5: note: include \xe2\x80\x98<stdio.h>\xe2\x80\x99 or provide a declaration of \xe2\x80\x98printf\xe2\x80\x99\n