两行代码实现字符串倒置

#include <stdio.h>
#include <string.h>
 
void reverse(char *p) {
    char c, *p1, *p2;
    for (p1=p, p2=p+strlen(p)-1; p1<p2; c=*p1, *p1=*p2, *p2=c, p1++, p2--);
}
 
/**test**/
int main() {
    char p[4] = {'a','b','c',''};
    reverse(p);
    puts(p);
    return 0;
}
原文地址:https://www.cnblogs.com/rinack/p/4135503.html