将一个数组逆序输出

题目:将一个数组逆序输出。

12345678910111213141516171819202122
#include <stdio.h>void Reverse(char* ch,int sz){    int i,j=0;    char temp[sz];    for (i=sz-1; i>=0; i--)//先把逆序的数组保存到一个新的临时数组中    {        temp[j] = ch[i];        j++;    }    for (i=0; i<sz; i++) //把新的临时数组内容赋值给原数组    {        ch[i] = temp[i];    }}int main() {    char ch[] = "abcdefghijsdfwdfasdfewfdqxsaefw";    int sz = sizeof(ch)/sizeof(ch[0])-1;    Reverse(ch,sz);    printf("%s",ch);    return 0;}
🔍 ×