#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
void Change_arrange(char str[],int size)
{
char tmp = ’ ';
for (int i = size - 2; i >= 0; i–)
{
for (int j = 0; j <= i; j++)
{
tmp = str[j];
str[j] = str[j + 1];
str[j + 1] = tmp;
}
}
}
int main()
{
char str[] = “luodong”;
int size=strlen(str);
Change_arrange(str, size);
printf("%s",str);
system(“pause”);
return 0;
}
将字符串反序存储
最新推荐文章于 2022-11-05 13:55:20 发布