【本程序在Dev C++ 4.9.9.2 下编译通过】
/*
Reverses the order of characters in the string.
The terminating null character remains in place.
把字符串的所有字符的顺序颠倒过来(不包括空字符NULL)。
返回指向颠倒顺序后的字符串指针。
*/
char * my_strrev(char *str)
{
char *right = str;
char *left = str;
char ch;
while (*right) right++;
right--;
while (left < right)
{
ch = *left;
*left++ = *right;
*right-- = ch;
}
return(str);
}