当前位置:网站首页>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;
}
边栏推荐
- Interview Question: Implementing Deadlocks
- 继承的注意事项
- /etc/sysconfig/network-scripts configure the network card
- 如何撰写出一篇优质的数码类好物推荐文
- [Reading Notes -> Data Analysis] 02 Data Analysis Preparation
- 硬件设备计算存储及数据交互杂谈
- EntityFramework保存到SQLServer 小数精度丢失
- [Cloud Residency Co-Creation] [HCSD Big Celebrity Live Broadcast] Personally teach the secrets of interviews in big factories
- Web3.0: Building an NFT Market (1)
- Web API 介绍和类型
猜你喜欢

类和对象:中

VPGNet

Carefully summarize thirteen suggestions to help you create more suitable MySQL indexes

Southern University of Science and Technology: Xiaoying Tang | AADG: Automatic Enhancement for Generalization in the Field of Retinal Image Segmentation

《ArchSummit:时代的呐喊,技术人听得到》

/etc/sysconfig/network-scripts configure the network card

ECCV2022 Workshop | 复杂环境中的多目标跟踪和分割

Matlab / ArcGIS 处理GPM全球月均降水数据

Redis五种数据类型简介

JVM面试题总结(持续更新中)
随机推荐
南方科技大学:Xiaoying Tang | AADG:视网膜图像分割领域泛化的自动增强
Pylint检查规则中文版
Flink 1.13(八)CDC
力扣2326、197
Automated machine learning pycaret: PyCaret Basic Auto Classification LightGBM
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
date命令
NIO programming
Binary tree traversal non-recursive program -- using stack to simulate system stack
[AMEX] LGBM Optuna美国运通信用卡欺诈赛 kaggle
[Reading Notes -> Data Analysis] 02 Data Analysis Preparation
简单的vim配置
Mysql environment installation under Linux (centos)
Inheritance and friend, static member relationship
编写方法将一个数组扁平化并且去重和递增排序
消息队列存储消息数据的MySQL表格
Southern University of Science and Technology: Xiaoying Tang | AADG: Automatic Enhancement for Generalization in the Field of Retinal Image Segmentation
如何撰写出一篇优质的数码类好物推荐文
值传递还是引用传递(By Value or By Reference)
vim的基本使用-命令模式