View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main()
{
 int i,j;
 int a[80],b[80];
  gets(a);
  for(i=0;i<(int)strlen;i++)
  {
   if(a[i]>='0'&&a[i]<='9';)
     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: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:7:8: warning: passing argument 1 of 'gets' from incompatible pointer type [-Wincompatible-pointer-types]
   gets(a);
        ^
In file included from Main.c:1:
/usr/include/stdio.h:583:14: note: expected 'char *' but argument is of type 'int *'
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.c:8:13: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   for(i=0;i<(int)strlen;i++)
             ^
Main.c:10:27: error: expected ')' before ';' token
    if(a[i]>='0'&&a[i]<='9';)
      ~                    ^
                           )
Main.c:15:3: error: 'else' without a previous 'if'
   else if(b[j-1]!='*')
   ^~~~
*/

Double click to view unformatted code.


Back to problem 50