View Code of Problem 58

#include<stdio.h>
int main()
{
    char a[100];  
    int cunt=0,i;
    gets(a); 
    for(i=0;str[i]!='\0';i++)
     {
         if(str[i]==' ')
	    cunt++;
     }
     cunt=cunt+1;
     }
    printf("%d",cunt);
    return 0;
}
/*
Main.c: In function 'main':
Main.c:6:5: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
     gets(a); 
     ^
Main.c:7:13: error: 'str' undeclared (first use in this function)
     for(i=0;str[i]!='\0';i++)
             ^
Main.c:7:13: note: each undeclared identifier is reported only once for each function it appears in
Main.c: At top level:
Main.c:14:12: error: expected declaration specifiers or '...' before string constant
     printf("%d",cunt);
            ^
Main.c:14:17: error: unknown type name 'cunt'
     printf("%d",cunt);
                 ^
Main.c:15:5: error: expected identifier or '(' before 'return'
     return 0;
     ^
Main.c:16:1: error: expected identifier or '(' before '}' token
 }
 ^
*/

Double click to view unformatted code.


Back to problem 58