View Code of Problem 58

#include <stdio.h>
int main()
{
	int i,n=0;
  	char a[100];
  	gets(a);
  	for(i=0;a[i]!='\0';++i)
        {
        	if(a[i]!=''&&(a[i+1]==' '||a[i+1]=='\0'))
                  n++;
        
        }
  	printf("%d",n);



}
/*
Main.c: In function 'main':
Main.c:6:4: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
    gets(a);
    ^
Main.c:9:19: error: empty character constant
          if(a[i]!=''&&(a[i+1]==' '||a[i+1]=='\0'))
                   ^
*/

Double click to view unformatted code.


Back to problem 58