。用C语言写一段代码解决字符逆序输出
#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;
}
原文地址: https://www.cveoy.top/t/topic/hfPX 著作权归作者所有。请勿转载和采集!