1.使用string.h中的strrev函数

 #include<stdio.h>
#include<string.h>
int main()
{
char s[]="hello";
strrev(s);
puts(s);
return ;
}

2.使用algorithm中的reverse函数

 #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string s= "hello";
reverse(s.begin(),s.end());
cout<<s<<endl;
return ;
}

这两个函数在我测试的时候出现了两种完全不同的情况

1.strrev函数只对字符数组有效,对string类型是无效的。

2.reverse函数是反转容器中的内容,对字符数组无效。

最新文章

  1. Java 8 的 Nashorn 脚本引擎教程
  2. OpenCV配置经历简述
  3. 前端---DOM
  4. java多线程的几种实现方式记录
  5. android Activity类中的finish()、onDestory()和System.exit(0) 三者的区别
  6. 【BZOJ-2502】清理雪道 有上下界的网络流(有下界的最小流)
  7. hdu 1845
  8. Codeforce727B --- Bill Total Value(字符串处理 正则表达式)
  9. 使用node.js抓取有路网图书信息(原创)
  10. Python问题之奇怪诡异的Bug
  11. DJANGO,获取当前用户名,用户组名,用户组权限
  12. 一年四个P(Project)
  13. AES SHA-1 SM3 MD5
  14. JPA 批注参考
  15. Simple tutorial for using TensorFlow to compute a linear regression
  16. numpy库补充 mean函数应用
  17. 七月在线爬虫班学习笔记(二)——Python基本语法及面向对象
  18. Centos下内网DNS主从环境部署记录
  19. 如何判断mac地址时multicast还是broadcast ?
  20. 使用Thrift让Python为Java提供服务

热门文章

  1. 单源最短路dijkstra算法&amp;&amp;优化史
  2. TeamViewer13个人版使用中提示为商用版导致无法使用
  3. 15-oauth2+oidc实现Server部分
  4. java生成PDF,并下载到本地
  5. 优步UBER司机全国各地奖励政策汇总 (2月22日-2月28日)
  6. c++继承详解:共有(public)继承,私有继承(private)继承,保护(protected)继承
  7. mysql题目练习的答案
  8. Unbuntu安装RVM
  9. ShimmerTextView
  10. libevent学习八(evbuffer)