字符串颠倒

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

posted on 2009-01-16 17:12  lei1217  阅读(204)  评论(0编辑  收藏  举报

导航