C小程序求助

158关注427浏览

功能:将主函数中输入的字符串反序存放。
例如:输入字符串“abcdefg”,则应输出“gfedcba”。
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define N 81
void main()
{
void fun(char *str,int n);
char s [N];
int

展开全部
收起
2回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • LiyaLiya

    19人对此回答表示赞同

    char *head = str;
    char *tail = str + n;
    while (head < tail)
    {
    char tmp = *head;
    *head++ = *tail;
    *tail-- = tmp;
    }
    展开
    19
    0回复
    发布于 6年前

    评论(0)

    收起评论

  • Rosslyn

    8人对此回答表示赞同

    int i;
    char ch;
    for(i = 0; i < n / 2; i++)
    {
    ch = str[i];
    str[i] = str[n - i -1];
    str[n - i - 1] = ch;
    }
    展开
    8
    0回复
    发布于 6年前

    评论(0)

    收起评论

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部