27、给定程序MODI1.C中函数fun的功能是: 比较两个字符串,将长的那个字符串的首地址作为函数值返回。
请改正函数fun中指定部位的错误, 使它能得出正确的结果。
注意: 不要改动main函数, 不得增行或删行, 也不得更改程序的结构!
#include /**********found**********/
char fun(char *s, char *t)
{ int sl=0,tl=0; char *ss, *tt;
ss=s; tt=t;
while(*ss)
{ sl++;
/**********found**********/
(*ss)++;
}
while(*tt)
{ tl++;
/**********found**********/
(*tt)++;
}
if(tl>sl) return t;
else return s;
}
main()
{ char a[80],b[80];
printf("\nEnter a string : "); gets(a);
printf("\nEnter a string again : "); gets(b);
printf("\nThe longer is :\n\n\"%s\"\n",fun(a,b));
}
| 广告合作:400-664-0084 全国热线:400-664-0084 Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号 珠峰网 版权所有 All Rights Reserved
|