【头文件】#include <string.h>

【原型】

char *strcat(char *dest, const char *src);

【参数】: dest 为目标字符串指针,src 为源字符串指针。

strcat() 会将参数 src 字符串复制到参数 dest 所指的字符串尾部;dest 最后的结束字符 NULL 会被覆盖掉,并在连接后的字符串的尾部再增加一个 NULL。

【注意】 dest 与 src 所指的内存空间不能重叠,且 dest 要有足够的空间来容纳要复制的字符串

【返回值】 返回dest 字符串起始地址。

【实例】连接字符串并输出。

    #include <stdio.h>
#include <string.h>
int main ()
{
char str[80];
strcpy (str,"these ");
strcat (str,"strings ");
strcat (str,"are ");
strcat (str,"concatenated.");
puts (str);
return 0;
}

输出结果:
these strings are concatenated.

C语言拼接字符串 -- 使用strcat()函数的更多相关文章

  1. python中的printf:%号拼接字符串和format函数

    在C语言中,我们使用printf("%s","hello")这种形式进行字符串的拼接 在python中,进行这样的拼接有两种实现方式,分别是%号拼接以及使用fo ...

  2. C语言拼接字符串以及进制转换

    #include<stdio.h> #include<stdlib.h> #include<string.h> char *join1(char *, char*) ...

  3. c语言 拼接字符串

    #include<stdio.h> #include<stdlib.h> void main() { ] = "ca"; ] = "lc" ...

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

    C语言strcat()函数:字符串连接(拼接)   C语言 strcat() 函数用来将两个字符串连接(拼接)起来. 头文件:string.h 语法/原型: char*strcat(char* str ...

  5. C 实现strcmp,strcpy,strcat函数

    基于C语言的strcmp,strcpy,strcat函数的实现.C语言是一个程序猿的基础,一定要重视. char* strcat ( char * dst , const char * src ) { ...

  6. C语言学习之我见-strcat()字符拼接函数(有缺陷)

    strcat()函数,用于两个字符串的拼接. (1)函数原型: char * strcat(char *Dest,const char * Source); (2)头文件: #include < ...

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

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

  8. C语言常用字符串函数总结

    ANSI C中有20多个用于处理字符串的函数: 注意:const 形参使用了const限定符,表示该函数不会改变传入的字符串.因为源字符串是不能更改的. strlen函数: 函数原型:unsigned ...

  9. C语言之字符串处理函数

    C语言中字符串处理函数介绍 下面介绍8种基本的常用的字符串处理函数,在数值数组中也常常用到(部分函数).所有的C语言编译系统中一般都提供这些函数. 1.puts函数——输出字符串的函数 一般的形式为p ...

随机推荐

  1. 2018 CCPC网络赛 1010 hdu 6447 ( 树状数组优化dp)

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=6447 思路:很容易推得dp转移公式:dp[i][j] = max(dp[i][j-1],dp[i-1][j ...

  2. MT【13】三角函数求范围

    解答:AB显然正确,C中$a$取0时,解为三个,C 错误.我们主要看一下D 评:这里提供了一个处理$sin^2xcosx$的常见方法:平方,单变量后用算术几何不等式.

  3. 【Gym 100733D】Little thief Shi(取数,DP)

    题 Shi realized that he was almost out of money, even renting Shitalian lands. Shi was walking on a s ...

  4. Mysql读写分离php脚本

    <?php/*php如何连接mysql*/ /*$link = mysql_connect(‘localhost‘, ‘root‘, ‘‘);if (!$link) {die(‘Could no ...

  5. Hadoop HDFS命令

    hadoop fs -mkdir  创建HDFS目录 # hadoop fs -mkdir /data Hadoop fs -ls  列出HDFS目录 # hadoop fs -ls /data ha ...

  6. protobuf for java

    本文档为java编程人员使用protocol buffer提供了一个基本的介绍,通过一个简单的例程进行介绍.通过本文,你可以了解到如下信息: 1.在一个.proto文件中定义一个信息格式. 2.使用p ...

  7. Android 屏幕手势滑动中onFling()函数的技巧分析

    关于如何处理手势操作以及那四个基本固定的顺序我就不讲解了,这里直接跳到我们获得瞬间滑动后回调onFling()这个抽象函数时,应该如何根据参数比较准确的判断滑动方向.如果你没有前面的基础知识,你可以去 ...

  8. eclipse index 不工作 F3 不能找到头文件

    To add paths containing code to parse, follow these steps :1. Right click on the project2. Select Pr ...

  9. SQL Server 查

    注:where语句是条件,后面加and或者or 时间日期:比时间需要时间加引号 模糊查询:where语句后面加like  '%包含此关键字%'或者'以此关键字开头%'或者'%结尾' 排序查询:列名 o ...

  10. swap(十六)

    a = 12 b = 33 a,b=b,a print(a,b)