搜索
查看: 864|回复: 4
打印 上一主题 下一主题

【一天一练】【2014.6.20】【反序输出字符串】

[复制链接]
楼主
发表于 2017-11-19 14:09:31 | 显示全部楼层
so easy!
[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *fzstr(char *str)
{
        int i,j;
    for(i=0,j=strlen(str)-1;i<j;i++,j--)
    {
                //通过位运算交换数值
        str^=str[j];
                str[j]^=str;
                str^=str[j];
    }
}
int main()
{
        char str[10001];
    gets(str);
    fzstr(str);
    puts(str);
    system("pause");
        return 0;
}
[/mw_shl_code]随手就能写出。[url=]呲牙[/url]
[url=] [/url]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表