【本程序在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);
}