字符串逆置位
void Reverse(char* str)
{
char* left = str;
char* right = str + strlen(str) - 1;
while (left < right)
{
char temp = *left;
*left = *right;
*right = temp;
++left;
--right;
}
}
#include<stdio.h>
int main()
{
char str[100] = { 0 };
while (gets(str))
{
Reverse(str);
printf("%s\n", str);
}
return 0;
}