# include <stdio.h>
char* reverse_string(char *string)
{
char temp;
char *top = string;
char *end = string;
while (*end != '\0')
{
end++;
}
end--;
for (; top < end; (top ++ && end--))
{
temp = *top;
*top = *end;
*end = temp;
}
return string;
}
int main()
{
char a[] = "qwetrytuy";
printf("%s\n", reverse_string(a));
return 0;
}
编写一个程序 将字符串翻转
最新推荐文章于 2023-03-19 22:59:07 发布