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