LeetCode 344
2024-08-29 16:03:59
Reverse String
Write a function that takes a string as input and returns the string reversed.
Example:
Given s = "hello", return "olleh".
/*************************************************************************
> File Name: LeetCode344.c
> Author: Juntaran
> Mail: Jacinthmail@gmail.com
> Created Time: 2016年05月10日 星期二 02时25分37秒
************************************************************************/ /************************************************************************* Reverse String Write a function that takes a string as input and returns the string reversed. Example:
Given s = "hello", return "olleh". ************************************************************************/ #include "stdio.h" char* reverseString(char* s)
{
int i;
int length = strlen(s);
char temp; for( i=; i<length/; i++ )
{
temp = s[i];
s[i] = s[length-i-];
s[length-i-] = temp;
}
return s;
} int main()
{
char* s = "hello";
reverseString(s);
return ;
}
最新文章
- BPM配置故事之案例4-子表
- centos 7 install python spynner
- WIN32服务程序(二):卸载服务
- Linux内核分析——汇编代码执行及堆栈变化
- 网页特殊符号HTML代码大全
- SlickGrid example 5:带子项的展开收缩
- CodeForces 483B Friends and Presents
- Open vSwitch FAQ (二)
- 一起学习 微服务(MicroServices)-笔记
- python学习之subprocess模块
- UVA 10806 Dijkstra, Dijkstra.(费用流)
- java跨平台性分析
- 小米2s的座充,看看这个是什么芯片? - 电池&综合DIY(Flashlight Electronics-Batteries Include - 手电大家谈-手电筒爱好者之家
- SDN学习之OpenFlow协议分析
- S7-200和S7-300profibus-DP通信
- 【括号问题】$(";li:lt("; + (idx + 1) + ";)";) 手风琴效果注意事项
- Java EE开发技术课程
- restful : 面向资源架构
- 动态产生DataSource------待整理
- spring cloud: Hystrix(一):简单使用
热门文章
- C++11 能好怎?
- homework-08-作业2
- jquery easyui的异步tree
- HDU1028Ignatius and the Princess III(母函数)
- poj 3635 Full Tank? ( bfs+dp思想 )
- react native 遇到的坑
- 用BenchmarkDotNet给C#程序做性能测试
- 在Mac OS X下让你的Terminal带上Color
- PL/pgSQL的RETURN QUERY例子
- Visio Premium 2010密钥+破解激活方法