迷离半醉


私信TA

用户名:1344641766

访问量:8653

签 名:

欢迎大家加入C语言交流群:727143693

等  级
排  名 1077
经  验 3104
参赛次数 2
文章发表 15
年  龄 0
在职情况 学生
学  校 哈尔滨佛学院
专  业

  自我简介:

 

0.0分

2 人评分

  评论区

#include<stdio.h>
#include<string.h>

int main()
{
	char x[50]={0};
	scanf("%s",x);
	int i,len=strlen(x);
	printf("%s",x);
	for(i=len-1;i>=0;i--)
	{
		printf("%c",x[i]);
	}
	
}
2021-05-13 11:26:42
#include "stdio.h"
#include "string.h"
#define N 1000
char* recat(char *p){
    char toCat[N];
    int len_p = (int)strlen(p);
    for (int i = 0; i < len_p; i++) {
        toCat[i] = p[len_p - 1-i];
    }
    strcat(p, toCat);
    return p;
}
int main(){
    char p[N];
    gets(p);
    puts(recat(p));
    return 0;
}

这是我的解法 使用puts和gets,数组长度设置成很大保证不会出错
2020-11-30 12:27:58
  • «
  • 1
  • »