#include<stdio.h>
//如果一个数组做为函数的形参传递,那么数组可以在被调用的函数中修改
//有时候不希望这个事发生,所以对形参采用const参数
//size_t strlen(const char *s);
//strcpy(char* s1,const char* s2);
void mystrcat(char *s1,const char *s2)
{
int len = ;
while(s2[len])
{
len++;
}
while(*s1)
{
s1++;
}
int i;
for(i = ; i < len; i++)
{
*s1 = *s2;
s1++;
s2++;
}
} int main()
{
char s1[] = "";
char s2[] = "";
mystrcat(s1,s2);
printf("s1 = %s\n",s1);
return ;
}

mystrcat的更多相关文章

  1. 字符串自实现(一)(mystrcpy,mystrcat,mystrcmp)

    char* mystrcpy(char* str_one,const char* str_two) { char* tmp = str_one; while (*str_one++ = *str_tw ...

  2. strcat 函数的实现

    原型        extern char *strcat(char *dest,char *src); 用法        #include <string.h> 功能        把 ...

  3. 《C标准库》——之<string.h>

    <string.h>里的字符串操作函数是经常要用到的,因此阅读了源码后自己实现了一些: 拷贝函数 void * Mymemcpy(void * sDst, const void * sSr ...

  4. 自己用c语言实现字符串处理库函数以及扩展

    1.实现基本的c语言库函数: int myStrlen( const char* str);//根据传入的字符串首地址获取字符串长度:返回值为长度 int myStrlen(const char* s ...

  5. C string.h 常用函数

    参考:http://womendu.iteye.com/blog/1218155 http://blog.csdn.net/zccst/article/details/4294565 还有一些,忘记了 ...

  6. 字符串链接strcat

    #include "stdafx.h" #include "iostream" #include "assert.h" #include & ...

  7. cc代码学习笔记1

    #define #define INT32 int #define INT8 char #define CHAR char #define SSHORT signed short #define IN ...

  8. typedef的使用3——使用经过typedef定义的函数构成的函数数组

    #include <stdio.h> #include <string.h>//不加还能跑,加上反而跑不了了...笑哭 #pragma warning(disable:4996 ...

  9. typedef的使用2——定义函数

    #include <stdio.h> #include <string.h> #pragma warning(disable:4996) //闲言碎语都先不要讲了,直接上函数吧 ...

随机推荐

  1. java-selenium上传

    一.sendkeys()上传 HTML源码 <td>sendkeys上传</td> <div id='pf'><input type='file' id='p ...

  2. [Luogu5686] 和积和

    Description 给定两个下标从\(1\)到\(n\)编号的序列 \(a_i,b_i\),定义函数\(S(l,r)(1\le l\le r\le n)\)为: \[\sum_{i=l}^r a_ ...

  3. PHP,mysql,nginxunx中安装

    一:安装PHP,mysql,nginx linux装软件方式: 1.源码安装:下载wget-->解压tar -zxvf -->配置 ./configure --->编译make -- ...

  4. Django项目运行端口被占用

    error:以一种访问权限不允许的方式做了一个访问套接字的尝试,是8000端口被其他程序占用了,杀掉占用的程序就可以 (1)查找哪个进程占用了8000端口 `E:\sign_system\guest& ...

  5. mybatis N+1问题解决

    关联嵌套查询 示例: <resultMap id="blogResult" type="Blog"> <association propert ...

  6. 第二篇 jQuery 选择器

    2-1,2  table隔行变色 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...

  7. vue-router实现原理

    vue-router实现原理 近期面试,遇到关于vue-router实现原理的问题,在查阅了相关资料后,根据自己理解,来记录下.我们知道vue-router是vue的核心插件,而当前vue项目一般都是 ...

  8. openlayers之全屏控件的使用

    import { FullScreen } from 'ol/control' map.addControl(new FullScreen())

  9. 依赖注入 php

    依赖注入:将当前类依赖的对象,以参数的方式注入到当前类中,简称依赖注入 <?php class Mi { public function size() { return '5.99寸全面屏'; ...

  10. MP4 ISO基础媒体文件格式术语

    术语.定义和缩略术语 box 由唯一类型标识符和长度定义的面向对象的构造块(注:在一些标准称为“atom") chunk(块) 一个track连续采样集合 container box 唯一目 ...