#include <stdio.h> #include <string.h>

int main() { char str[100], temp; int i, j;

printf("输入字符串:");
scanf("%s", str);

j = strlen(str) - 1;

for (i = 0; i < j; i++, j--) {
    temp = str[i];
    str[i] = str[j];
    str[j] = temp;
}

printf("逆序输出字符串:%s", str);

return 0;

}

。用C语言写一段代码解决字符逆序输出

原文地址: https://www.cveoy.top/t/topic/hfPX 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录