字符串反转

char *revstr(char *str, size_t len)
{
    char    *start = str;
    char    *end = str + len - 1;
    char    ch;

    if (str != NULL)
    {
        while (start < end)
        {
            ch = *start;
            *start = *end;
            *end = ch;
start++;
           
end--; } }
return str; }

 详情参考:http://www.cnblogs.com/pianoid/archive/2011/10/30/string_reverse_in_c_language.html

posted @ 2013-06-07 19:59  独墅一枝花  阅读(106)  评论(0编辑  收藏  举报