#include <stdio.h>
#include <string.h>
#include <assert.h>
void str_reverse_order(char *str){
assert(str);
int sz = strlen(str);
char * left = str;
char * right = str +sz - 1;
while(left < right){
char temp = *left;
*left = *right;
*right = temp;
left++;
right--;
}
}
int main()
{
char str[24] = {0};
scanf("%s",str);
str_reverse_order(str);
printf("%s\n",str);
return 0;
}
C:逆序输出字符串
最新推荐文章于 2024-05-11 12:57:23 发布