字符串颠倒

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);
}

你可能感兴趣的:(字符串颠倒)