View Code of Problem 50

#include<stdio.h>
int main()
{
 char a[80],b[80];
  int i,j=0;
  gets(a);
  for(i=0;i<strlen(a);i++)
  {
  if(i=0;i<strlen(a);i++)
  {
   b[j]=a[i];
    putchar(b[j]);
    j++;
  }
    else if(b[j-1]!='*')
    {
     b[j]='*';
      putchar(b[j]);
      j++;
    }
  }
  printf("\n");
  return 0;
}
/*
Main.c: In function 'main':
Main.c:6: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:7:13: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
   for(i=0;i<strlen(a);i++)
             ^~~~~~
Main.c:7:13: warning: incompatible implicit declaration of built-in function 'strlen'
Main.c:7:13: note: include '<string.h>' or provide a declaration of 'strlen'
Main.c:2:1:
+#include <string.h>
 int main()
Main.c:7:13:
   for(i=0;i<strlen(a);i++)
             ^~~~~~
Main.c:9:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   if(i=0;i<strlen(a);i++)
      ^
Main.c:9:9: error: expected ')' before ';' token
   if(i=0;i<strlen(a);i++)
     ~   ^
         )
*/

Double click to view unformatted code.


Back to problem 50