#include "stdio.h"
#include "string.h"
void inverse(char str[])
{
int i,length;
char tmp;
length=strlen(str);
for(i=0;i<length/2;i++)
{
tmp=str[i];
str[i]=str[length-1-i];
str[length-1-i]=tmp;
}
}
void main()
{
char ch[80];
printf("请输入一个字符串:");
gets(ch);
inverse(ch);
printf("逆序存储后的字符串为:");
puts(ch);
}
![](https://iknow-pic.cdn.bcebos.com/f9198618367adab4171f812589d4b31c8601e48d?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto)