C 把一个字符串倒序输出

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

int main()
{
char str[] = "abcde";
char temp[] = "";
int i, j;
for(i = 0; i<5; i++)
{
temp[i] = str [4-i];
}
strcpy(str, temp);
printf("%s\n",str);
}

结果:

# gcc test_point.c -o test_point
# ./test_point
str:edcba
原文地址:https://www.cnblogs.com/qingjoin/p/2412312.html