当前位置:网站首页>C string array reverse
C string array reverse
2022-08-01 01:08: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;
}
边栏推荐
猜你喜欢
STK8321 I2C(昇佳-加速度传感器)示例
清华大学陈建宇教授团队 | 基于接触丰富机器人操作的接触安全强化学习框架
Carefully organize 16 MySQL usage specifications to reduce problems by 80% and recommend sharing with the team
【密码学/密码分析】基于TMTO的密码分析方法
机器学习初学者可以学哪些实战项目?
【 】 today in history: on July 31, "brains in vats" the birth of the participant;The father of wi-fi was born;USB 3.1 standard
【历史上的今天】7 月 31 日:“缸中之脑”的提出者诞生;Wi-Fi 之父出生;USB 3.1 标准发布
Team of Professor Chen Jianyu of Tsinghua University | Contact Safety Reinforcement Learning Framework Based on Contact-rich Robot Operation
欧拉系统(euleros):升级Mysql
LeetCode每日一练 —— 环形链表问题(面试四连问)
随机推荐
Luogu P3373: 线段树
leetcode: 1562. Find latest grouping of size M [simulation + endpoint record + range merge]
zeno使用方法笔记
js 实现复制功能
【Cryptography/Cryptanalysis】Cryptanalysis method based on TMTO
Rainbow share | how to use moving targets defense technology to guard against the unknown
自动化机器学习pycaret: PyCaret Basic Auto Classification LightGBM
【密码学/密码分析】基于TMTO的密码分析方法
MYSQL索引解析
RTL8762DK RTC(五)
cobaltstrike
RTL8762DK Lighting/LED (3)
你需要知道的 TCP 四次挥手
JVM面试题总结(持续更新中)
July Bootcamp (Day 31) - Status Compression
qlib量化源码分析:qlib/qlib/contrib/model/gbdt.py
Web API 介绍和类型
ECCV2022 Workshop | Multi-Object Tracking and Segmentation in Complex Environments
蓝图:杨辉三角排列
Cmake introductory study notes