C++ (Qt)string str = "abcdefghijkl"; int i,count; int len = str.length()-1; for (i=len, count=0; i > count; i--, count++) { char a = str[i]; str[i] = str[count]; str[count] = a; }
Cchar* revStr(char *str) { if(!str) {return NULL;} for(char c, *s=str, *e=str+strlen(str)-1; s<e; ++s,--e) { c = *s; *s = *e; *e = c; } return str; }