View Code of Problem 52

#include<stdio.h>
#include<string.h>
int main()
{
  int len,i;
  char str[100];
  gets(str);
  len=strlen(str);
  for(i=len-1;i>=0,i--)
  {
   printf("%c",str[i]);
  }
  return 0;
}
/*
Main.c: In function 'main':
Main.c:7:3: warning: 'gets' is deprecated [-Wdeprecated-declarations]
   gets(str);
   ^~~~
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:9:19: warning: left-hand operand of comma expression has no effect [-Wunused-value]
   for(i=len-1;i>=0,i--)
                   ^
Main.c:9:23: error: expected ';' before ')' token
   for(i=len-1;i>=0,i--)
                       ^
                       ;
*/

Double click to view unformatted code.


Back to problem 52