解题思路:设置一个逆序的输出的公共变量——主函数输入任意字符——通过调用函数将字符反转存入公共的变量中;
注意事项:string()函数求字符数组的长度;字符串的最大下标需要注意:strlen()-1
参考代码:
#include<stdio.h>
#include<string.h>
char ss[99];
char fun(char s[])
{
int i=0,len;
len=strlen(s)-1;
while(s[i]!='\0')
{
ss[i++]=s[len--];
}
}
main()
{
char s[99];
scanf("%s",s);
fun(s);
printf("%s",ss);
}
0.0分
1 人评分
【出圈】 (C语言代码)浏览:796 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:605 |
【偶数求和】 (C语言代码)浏览:557 |
【计算直线的交点数】 (C语言代码)浏览:1452 |
出圈】指针malloc版浏览:355 |
1071题解浏览:493 |
钟神赛车 (C语言代码)浏览:600 |
字符串比较 (C语言代码)浏览:685 |
简单的事情 (C语言代码)浏览:638 |
C语言程序设计教程(第三版)课后习题6.7 (C语言代码)浏览:699 |