字符串逆序输出

#include<stdio.h>
#include<string.h>//定义字符串
int main()
{
    char str[100000];
    int n,j;
    scanf("%d",&n);
    getchar();//吸收空格,注意位置,加   :
    while(n--)
    {
        gets(str);//这样定义gets(str);表示从键盘接收一个字符串,并放到数组中
        int len=strlen(str);//字符串长度
        /*int i,a[45];
        for(i=0; i<len; i++)//
            scanf("%d",&a[i]);*/
        for(j=len-1; j>=0; j--)
        {
            if(str[j]>='a'&&str[j]<='z')
                printf("%c",str[j]);
        }
        printf(" ");
    }
    return 0;
}

"No regrets."
原文地址:https://www.cnblogs.com/zxy160/p/7215202.html