View Code of Problem 52

#include<stdio.h>
#include<string.h>
//将一个字符串str的内容颠倒过来,并输出。str的长度不超过100个字符。
int main(){
	char arrc[100];
	gets(arrc);
	for(int i=strlen(arrc)-1;i>=0;i--){
		printf("%c",arrc[i]);
	}
	printf("\n")
	return 0;
}
/*
Main.cc: In function 'int main()':
Main.cc:6:11: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(arrc);
           ^
In file included from Main.cc:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.cc:6:11: warning: 'char* gets(char*)' is deprecated [-Wdeprecated-declarations]
  gets(arrc);
           ^
In file included from Main.cc:1:
/usr/include/stdio.h:583:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
Main.cc:10:14: error: expected ';' before 'return'
  printf("\n")
              ^
              ;
  return 0;
  ~~~~~~       
*/

Double click to view unformatted code.


Back to problem 52