void reverse(char* str)
{
char *end = str, *begin=str;
char temp;
while(*end!='\0')
{
end++;
}
end--;
while(begin<=end)
{
temp = *end;
*end-- = *begin;
*begin++ = temp;
}
}

用C++实现void reverse(char* str)函数,即反转一个null结尾的字符串.的更多相关文章

  1. 回文字符串的判断!关于strlen(char * str)函数

    #include <stdio.h> #include <string.h> int ishuiw(char * p); int main() { ;//true-false接 ...

  2. 【转】char *str 和 char str[]的区别

    char str[] = "abcd";定义了一个局部字符数组,返回它的地址肯定是一个已经释放了的空间的地址. 此函数返回的是内部一个局部字符数组str的地址,且函数调用完毕后 此 ...

  3. char str[]和char *str的区别

    1.http://blog.csdn.net/szchtx/article/details/10396149 char ss[]="C++";  ss[0]='c';        ...

  4. char str[] 与 char *str的区别详细解析

    char* get_str(void) { char str[] = {"abcd"}; return str; } char str[] = {"abcd"} ...

  5. 编写函数int count_number_string(char str[])和函数int maxnum_string(char str[])

    题目如图: 这里不再赘述 代码: //字符串中统计与查询 //杨鑫 #include <stdio.h> #include <stdlib.h> #include <st ...

  6. public static void main(String[] args){}函数诠释

    public static void main(String[] args){}函数诠释 主函数的一般写法如下: public static void main(String[] args){-} 下 ...

  7. c++ void,内存操作函数

    void的含义 void的字面意思是“无类型”, void * 则为“无类型指针”, void * 可以指向任何类型的数据 void几乎只有“注释”和限制程序的作用,因为从来没有人会定义一个void变 ...

  8. str*函数和大小端判断

    #include <stdio.h> #include <assert.h> size_t mstrlen(const char *s) { assert(s != NULL) ...

  9. js中的join(),reverse()与 split()函数用法解析

    <script> /* * 1:arrayObject.reverse() * 注意: 该方法会改变原来的数组,而不会创建新的数组.此函数可以将数组倒序排列 * 2:arrayObject ...

随机推荐

  1. LeetCode OJ:Combination Sum III(组合之和III)

    Find all possible combinations of k numbers that add up to a number n, given that only numbers from ...

  2. Collection集合存储自定义对象练习

    public class Student { private String name; private int age; public Student() { super(); } public St ...

  3. Hadoop单机模式和伪分布式搭建教程CentOS

    1. 安装JAVA环境 2. Hadoop下载地址: http://archive.apache.org/dist/hadoop/core/ tar -zxvf hadoop-2.6.0.tar.gz ...

  4. Codeforces Round #286 (Div. 2)B. Mr. Kitayuta's Colorful Graph(dfs,暴力)

    数据规模小,所以就暴力枚举每一种颜色的边就行了. #include<iostream> #include<cstdio> #include<cstdlib> #in ...

  5. UVA - 11324 The Largest Clique (强连通缩点+dp)

    题目链接 题意:从有向图G中找到一个最大的点集,使得该点集中任意两个结点u,v满足u可达v或v可达u. 解法:先把同处于一个强连通分量中的结点合并(缩点),得到一张DAG图,在DAG上dp即可. 感觉 ...

  6. 综述c++

    1.背景 C语言作为结构化和模块化的语言,在处理较小规模的程序时,比较得心应手.但是当问题比较复杂,程序的规模较大时,需要高度的抽象和建模时,C语言显得力不从心. 2.应用领域 如果项目中,既要求效率 ...

  7. Unity4.6 UGUI 图片打包设置(小图打包成图集 SpritePacker)

    版权声明:本文转自http://blog.csdn.net/huutu 转载请带上 http://www.liveslives.com/ 在学习UGUI的过程中,一直使用小图也就是散图,一个按钮一个图 ...

  8. MAC的VMWare CentOS 6.8命令笔记

    1.图形界面切换到命令行界面 真正的Linux切换界面使用命令, Ctrl + Alt + Fn (1,2,3,4,5,6)           Wondows平台 Ctrl + option + F ...

  9. keepalived之 Keepalived 原理(定义、VRRP 协议、VRRP 工作机制)

    1.Keepalived 定义 Keepalived 是一个基于VRRP协议来实现的LVS服务高可用方案,可以利用其来避免单点故障.一个LVS服务会有2台服务器运行Keepalived,一台为主服务器 ...

  10. HDU5475(线段树)

    An easy problem Time Limit: 8000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...