int revert(char* str, int len) { char* p = str; char* q = str + len -1; for(; p<q; ++p, --q) { char c = *p; *p = *q; *q = c; } }