输出字符串的逆序

    技术2024-09-28  53

    C语言输出字符串的逆序

    思路:利用strlen函数获取字符串长度然后倒着输出,可以参考整数的逆序输出 https://blog.csdn.net/qq_43622870/article/details/104817209

    #include<stdio.h> #include<string.h> int main() { char a[100]; scanf("%s", &a); int n = strlen(a); for (int i = n - 1; i >= 0; i--) printf("%c", a[i]); return 0; }

    Processed: 0.010, SQL: 9