View Code of Problem 52

#include <stdio.h>
int main()
{
	char s[100];
	gets(s);
	for (int i = strlen(s) - 1; i >= 0; i--)
		printf("%c", s[i]);
	printf("\n");
	return 0;
}
/*
Main.c: In function 'main':
Main.c:5:2: warning: 'gets' is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
  gets(s);
  ^
Main.c:6:2: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
  for (int i = strlen(s) - 1; i >= 0; i--)
  ^
Main.c:6:15: warning: incompatible implicit declaration of built-in function 'strlen'
  for (int i = strlen(s) - 1; i >= 0; i--)
               ^
Main.c:6:2: error: declaration of non-variable 'strlen' in 'for' loop initial declaration
  for (int i = strlen(s) - 1; i >= 0; i--)
  ^
*/

Double click to view unformatted code.


Back to problem 52