当前位置:网站首页>C字符串数组反转
C字符串数组反转
2022-08-01 00:30:00 【ma_de_hao_mei_le】
友链
#include <stdio.h>
#include <string.h>
void reverse(char* s) {
int len = strlen(s);
for (int i = 0; i < len / 2; i++) {
int diff = *(s + i) - *(s + (len - i - 1));
*(s + i) = *(s + i) - diff;
*(s + (len - i - 1)) = *(s + (len - i - 1)) + diff;
}
}
int main()
{
char s[123] = "1234567890";
reverse(s);
printf("%s\n", s);
return 0;
}
边栏推荐
- Key Points Estimation and Point Instance
- 编程语言是什么
- Recommendation system: Summary of common evaluation indicators [accuracy rate, precision rate, recall rate, hit rate, (normalized depreciation cumulative gain) NDCG, mean reciprocal ranking (MRR), ROC
- Team of Professor Chen Jianyu of Tsinghua University | Contact Safety Reinforcement Learning Framework Based on Contact-rich Robot Operation
- 什么时候可以使用 PushGateway
- /etc/sysconfig/network-scripts 配置网卡
- 信奥学习规划 信息学竞赛之路(2022.07.31)
- WeChat applet page syntax
- 博弈论(Depu)与孙子兵法(42/100)
- 什么是动态规划,什么是背包问题
猜你喜欢

游戏安全03:缓冲区溢出攻击简单解释

2022-07-31:给出一个有n个点,m条有向边的图, 你可以施展魔法,把有向边,变成无向边, 比如A到B的有向边,权重为7。施展魔法之后,A和B通过该边到达彼此的代价都是7。 求,允许施展一次魔法

精心总结十三条建议,帮你创建更合适的MySQL索引

MYSQL经典面试题
![[1161. The maximum sum of elements in the layer]](/img/59/7810f425431779aa719458038ea0b3.png)
[1161. The maximum sum of elements in the layer]

NIO编程

Rainbow share | how to use moving targets defense technology to guard against the unknown

微信小程序之小程序页面语法

TFC CTF 2022 WEB Diamand WriteUp

类和对象:中
随机推荐
精心总结十三条建议,帮你创建更合适的MySQL索引
The principle of virtual inheritance
类和对象:上
MYSQL索引解析
The difference between /usr/local/bin and /usr/bin
声称AI存在意识,谷歌工程师遭解雇:违反保密协议
qlib量化源码分析:qlib/qlib/contrib/model/gbdt.py
Thinking and Implementation of Object Cache Service
Matlab/ArcGIS processing GPM global monthly precipitation data
Basic use of vim - bottom line mode
Nmap Operation Manual - Full Version
Item 36: Specify std::launch::async if asynchronicity is essential.
【读书笔记->数据分析】02 数据分析准备
EntityFramework保存到SQLServer 小数精度丢失
SVN server construction + SVN client + TeamCity integrated environment construction + VS2019 development
【1161. 最大层内元素和】
/etc/resolv.conf的作用
继承和友元,静态成员的关系
Xinao Learning Plan The Road to Informatics Competition (2022.07.31)
网关gateway跨域