反转字符串

Write a function that takes a string as input and returns the string reversed.

Example:
Given s = "hello", return "olleh".

char* reverseString(char* s) {
    int len = strlen(s);
    for (int i=0; i<len/2; i++) {
        char t = s[i];
        s[i] = s[len-i-1];
        s[len-i-1] = t;
    }
    return s;
}
原文地址:https://www.cnblogs.com/wxisme/p/5940663.html