当前位置:网站首页>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;
}
边栏推荐
- In 2022, the latest eight Chongqing construction members (electrical construction workers) simulation question bank and answers
- Team of Professor Chen Jianyu of Tsinghua University | Contact Safety Reinforcement Learning Framework Based on Contact-rich Robot Operation
- 简单的vim配置
- 什么时候可以使用 PushGateway
- lua入门案例实战123DIY
- An open source and easy-to-use flowchart drawing tool drawio
- Introduction to the five data types of Redis
- leetcode:126. 单词接龙 II
- /etc/sysconfig/network-scripts 配置网卡
- date命令
猜你喜欢

Google Earth Engine——Error: Image.clipToBoundsAndScale, argument ‘input‘: Invalid type的错误解决

【读书笔记->数据分析】02 数据分析准备

Redis五种数据类型简介

SVN server construction + SVN client + TeamCity integrated environment construction + VS2019 development

Matlab / Arcgis处理nc数据
![[AMEX] LGBM Optuna American Express Credit Card Fraud Contest kaggle](/img/64/55af53a3d9dc1162490d613fe8a436.png)
[AMEX] LGBM Optuna American Express Credit Card Fraud Contest kaggle

Application of integrated stepper motor in UAV automatic airport

逐步手撕轮播图3(保姆级教程)

cobaltstrike

硬件设备计算存储及数据交互杂谈
随机推荐
WindowInsetsControllerCompat is simple to use
cobaltstrike
zeno使用方法笔记
LeetCode--打家劫舍问题
MVCC总结
Named Entity Recognition - Model: BERT-MRC
【1161. 最大层内元素和】
逐步手撕轮播图3(保姆级教程)
[MATLAB project combat] LDPC-BP channel coding
编译型语言和解释型语言的区别
Unity3D学习笔记10——纹理数组
C# Rectangle basic usage and picture cutting
面试题:实现死锁
NIO编程
TFC CTF 2022 WEB Diamand WriteUp
蓝图:杨辉三角排列
开源好用的 流程图绘制工具 drawio
虹科分享|如何用移动目标防御技术防范未知因素
Usage of mysql having
Carefully summarize thirteen suggestions to help you create more suitable MySQL indexes