标签:style blog color os io ar div log sp
#include <iostream> #include <algorithm> using namespace std; void reverse(char* str) { int length = strlen(str); char* str_head = str; char* str_tail = &str[length-1]; while(str_head < str_tail) swap(*str_head++,*str_tail--); } int main(int argc, const char * argv[]) { char str[256] = "Hel"; reverse(str); cout << str << endl; return 0; }
Cracking the Coding Interview 1-2
标签:style blog color os io ar div log sp
原文地址:http://www.cnblogs.com/vindicated/p/3947218.html