View Code of Problem 55

# include<stdio.h>
# include<string.h>
int main(void)
{
  int i,j=0;
  char str[100],c;
  gets(str);
  scanf("%c",&c);
  len = strlen(str);
  for(i=0;i<len;++i)
  {
    if(str[i]!=c)
    {
      str[j++] = str[i];
    }
  }
  for(i=o;i<j;++i)
  {
    printf("%s",str[i]);
  }
  return 0;
}
/*
Main.c: In function 'main':
Main.c:7:3: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
   gets(str);
   ^
Main.c:9:3: error: 'len' undeclared (first use in this function)
   len = strlen(str);
   ^
Main.c:9:3: note: each undeclared identifier is reported only once for each function it appears in
Main.c:17:9: error: 'o' undeclared (first use in this function)
   for(i=o;i<j;++i)
         ^
Main.c:19:5: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int' [-Wformat=]
     printf("%s",str[i]);
     ^
*/

Double click to view unformatted code.


Back to problem 55