View Code of Problem 58

#include<stdio.h>
#include<math.h>
void  main()
{
  int i,j;
  char a[100];
  gets(a);
  for(i=0;i<strlen(a);i++)
  {
   if(a[i]!=''&&a[i+1]=='')
     j++;
  }
  printf("%d",j);
  
}
/*
Main.c:3:7: warning: return type of 'main' is not 'int' [-Wmain]
 void  main()
       ^~~~
Main.c: In function 'main':
Main.c:7:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(a);
   ^~~~
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:8:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   for(i=0;i<strlen(a);i++)
             ^~~~~~
Main.c:8:13: warning: incompatible implicit declaration of built-in function 'strlen'
Main.c:8:13: note: include '<string.h>' or provide a declaration of 'strlen'
Main.c:3:1:
+#include <string.h>
 void  main()
Main.c:8:13:
   for(i=0;i<strlen(a);i++)
             ^~~~~~
Main.c:10:13: error: empty character constant
    if(a[i]!=''&&a[i+1]=='')
             ^~
Main.c:10:25: error: empty character constant
    if(a[i]!=''&&a[i+1]=='')
                         ^~
*/

Double click to view unformatted code.


Back to problem 58