#include<stdio.h> #include<string.h> int main() { char s[1000]; int n,i,len; gets(s); len=strlen(a); for(i=0;i<len;i++) { if(s[i]!=' '&&(s[i+1]==' '||s[i+1]=='\0')) n++; } printf("%d",n); return 0; } /* Main.c: In function 'main': Main.c:7:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations] gets(s); ^ Main.c:8:14: error: 'a' undeclared (first use in this function) len=strlen(a); ^ Main.c:8:14: note: each undeclared identifier is reported only once for each function it appears in */ |
Double click to view unformatted code.