ALGO-69 VIP试题 字符串逆序

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/y895315416/article/details/79784800
/*
输入一个字符串,长度在100以内,按相反次序输出其中的所有字符。
样例输入
tsinghua
样例输出
auhgnist
*/
#include <stdio.h>
#include <string.h>

void jh(char * );
int cd(char*);  

int main(void)
{
    char s[129];
    scanf("%s",s);
    jh(s);
    return 0;
}
void jh(char s[])
{
    int i=0;
    for (i=cd(s)-1; i >= 0; i --)
    {
        printf("%c",s[i]);
    }
}
int cd(char s[])
{
        int n = 0 ;
    while( s[n] != '\0' )
    {
        n ++ ;
    }
    return n ;
}

猜你喜欢

转载自blog.csdn.net/y895315416/article/details/79784800