1. strrev
#include <cstring>
char s[] = "hello";
strrev(s);
注:strrev函数只对字符数组有效,对string类型是无效的
2. reverse
#include <string>
#include <algorithm>
string s = "hello";
reverse(s.begin(), s.end());
#include <cstring>
char s[] = "hello";
strrev(s);
注:strrev函数只对字符数组有效,对string类型是无效的
#include <string>
#include <algorithm>
string s = "hello";
reverse(s.begin(), s.end());