c语言问题 急!!!

#include<stdio.h>#include<string.h>voidfun(char*s,char*t){/************found*********... #include <stdio.h>
#include <string.h>

void fun (char *s, char *t)
{
/************found************/
int i;
sl = strlen(s);
for (i=0; i<sl; i++)
/************found************/
t[i] = s[sl-i];
for (i=0; i<sl; i++)
t[sl+i] = s[i];
t[2*sl] = '\0';
}

main()
{ char s[100], t[100];
printf("\nPlease enter string s:"); scanf("%s", s);
fun(s, t);
printf("The result is: %s\n", t);
}

这个程序错哪了 怎么改
展开
 我来答
biosorry
2011-09-18 · TA获得超过7074个赞
知道大有可为答主
回答量:2544
采纳率:78%
帮助的人:792万
展开全部
1、sl没有定义
sl = strlen(s);改成int sl = strlen(s);
2、 t[i] = s[sl-i];
如果这样的话t[0]=s[sl]='\0'
所以字符串显示为空
改成t[i] = s[sl-i-1];
炫心吾动之夜爱
2011-09-18 · TA获得超过379个赞
知道小有建树答主
回答量:168
采纳率:0%
帮助的人:59.7万
展开全部
#include <stdio.h>
#include <string.h>

void fun (char *s, char *t)
{
/************found************/
int i;
int sl = strlen(s);
for (i=0; i<sl; i++)
/************found************/
t[i] = s[sl-i+1];
for (i=0; i<sl; i++)
t[sl+i] = s[i];
t[2*sl] = '\0';
}
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式