题解 | #字符逆序#
字符逆序
https://www.nowcoder.com/practice/cc57022cb4194697ac30bcb566aeb47b
//求出数组长度,倒序输出,注意输入包含空格。运用数组下标即指针 #include <stdio.h> #include <string.h> int main() { char str[10000] = {0}; while (gets(str) != NULL) { // getchar会读入回车;gets舍弃回车,可读空格;scanf读到空格或回车停 int len = strlen(str) - 1; while(len>-1) printf("%c",str[len--]); } return 0; }