原型:char  *strcat  ( char  *dest, const  char  *src)

用法:#include  <string.h>

功能:连接两个字符串;strcat()会将参数src字符串 拷贝到 参数dest所指的字符串尾。 第一个参数dest要有足够的空间来容纳要拷贝的字符串。

说明:strcat()返回dest的字符串起始地址。

#include<iostream>
using namespace std; int main()
{
char p1[] = "abcd", *p2, str[] = "xyz"; p2 = "ABCD";
strcpy(str + , strcat(p1 + , p2 + ));
printf(" %s", str);
}

答案:xycdBCD

 

strcat函数的更多相关文章

  1. C语言strcat()函数:连接字符串

    头文件:#include <string.h> strcat() 函数用来连接字符串,其原型为:    char *strcat(char *dest, const char *src); ...

  2. strcat函数的使用需要注意的问题

    曾被这个函数困扰了好久,然后各种假设,验证:但是最后却发现这个函数并没有什么好讲的,原来的过错一切都源于忽略了“*dst去掉\0,然后加上*src,最后返回*dst”这句话的真正含义:给*dst分配的 ...

  3. strcat()函数常见问题

    strcat(char *_Destination,const char *_Source)函数的功能是将后一个字符串粘贴到前一个字符串的末尾 原型 char *strcat(char *_Desti ...

  4. strcat函数造成的段错误(Segmentation fault)

    转自:http://book.51cto.com/art/201311/419441.htm 3.21  strcat函数造成的段错误 代码示例 int main() { char dest[7]=& ...

  5. 【C语言】模拟实现库函数strcat函数

    //模拟实现库函数strcat函数 #include <stdio.h> #include <string.h> #include <assert.h> char ...

  6. strcat函数的坑点

    我们先看下面这样一段代码: #include <iostream> #include <stdlib.h> using namespace std; int main() { ...

  7. 编写一个程序实现strcat函数的功能

    写自己的strcat函数------→mycat #include <stdio.h> #include <string.h> #define N 5 char *mycat( ...

  8. C语言中strcpy,strcmp,strlen,strcat函数原型

    //strcat(dest,src)把src所指字符串添加到dest结尾处(覆盖dest结尾处的'\0')并添加'\0' char *strcat(char * strDest, const char ...

  9. 由strcat函数引发的C语言中数组和指针问题的思考

    问题一 首先,来看一下下面这段代码: #include <stdio.h> #include <string.h> int main() { char *str = " ...

  10. strlen函数,strcat函数,strcpy函数,strncpy函数,strcmp函数

    strcpy函数: char *strcpy(char *Dest , const char *Src) { assert((Dest != NULL) && (Src != NULL ...

随机推荐

  1. java.util.zip.ZipException:ZIP file must have at least one entry

    1.错误描述 java.util.zip.ZipException:ZIP file must have at least one entry 2.错误原因 由于在导出文件时,要将导出的文件压缩到压缩 ...

  2. input 和button的区别

    一,区别一 先来看一个问题 <input type="button" class="btn-upload bg-org-code" name=" ...

  3. sqoop将mysql连表查询结果导入hdfs文件

    sqoop import --connect jdbc:mysql://ip/数据库 --username 用户名 --password 密码 --query " select p.bidN ...

  4. 小程序中点击input控件键盘弹出时placeholder文字上移

    最近做的一个小程序项目中,出现了点击input控件键盘弹出时placeholder文字上移,刚开始以为是软键盘弹出布局上移问题是传说中典型的fixed 软键盘顶起问题,因此采纳了网上搜到的" ...

  5. Bzoj1899: [Zjoi2004]Lunch 午餐

    题面 传送门 Sol 首先显然吃饭久的要排在前面 之后再来分配队伍,设\(f[i][j]\)表示到第\(i\)个人,\(A\)队伍要等\(j\)的最小吃完饭时间 那么就是一个简单的背包吧... # i ...

  6. 关系型数据库工作原理-客户端连接管理器(翻译自Coding-Geek文章)

    本文翻译自Coding-Geek文章:< How does a relational database work>.原文链接:http://coding-geek.com/how-data ...

  7. jq事件

    1,ready:当DOM载入就绪可以查询及操纵时绑定一个要执行的函数,在使用之前必须确保body元素的onload事件,,没有注册函数,否则不会触发ready函数. $(document).ready ...

  8. BZOJ1565 植物大战僵尸 题解

    题目内容: 题目分析:有选A则必须选B这样的限制条件,可以发现这是最大权闭合子图模型,考虑环的情况,可以推测需要拓扑判环. 代码: #include<bits/stdc++.h> usin ...

  9. 关于各种文件用Editplus的方式打开出现“向程序发送命令时出现问题”的解决方法

    其实网上有很多解决方法,但是我试过都没有用. 我出现这个错误的原因是因为我的Editplus是以管理员的方式运行的,所以解决的办法有两种: 一.修改Editplus的兼容性,方法如下: 首先在Edit ...

  10. 在Simplicity Studio下创建适用于EFR32的工程项目

    1.使用平台 使用平台描述了在Simplicity Stdio下创建工程时所使用的操作系统与软件版本等. 操作系统:Windows 10 Simplcity Studio版本:Simlicity St ...