分类: C/C++
2014-03-09 16:15:14
void swap(char *str, int begin, int end) { char ch; while (begin < end) { ch = *(str + begin); *(str + begin) = *(str + end); *(str + end) = ch; begin++; end--; } }
void Rotate(char *str, int length ,int m) { if (NULL == str || length == 1) { return; } swap(str, 0, m - 1); swap(str, m, length - 1); swap(str, 0, length - 1); }
int _tmain(int argc, _TCHAR* argv[]) { char chArr[] = "abcdef"; char *p = chArr; cout<2); cout<
return 0; }