当前位置:网站首页>Strcat () - connection string
Strcat () - connection string
2022-07-21 05:58:00 【InfoQ】
write in front
strcat() - Connection string
char *strcat(char *dest, const char *src)
char arr[20] = "Cyuyan"
strcat(arr,arr);
printf("%s\n",arr);
strcat() Function code example
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
int main(void)
{
char arr1[20] = "hello C";
char arr2[20] = "yuyan";
strcat(arr1, arr2);
printf("arr1 = %s\n", arr1);
return 0;
}

Create a custom function implementation strcat() The function of
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>
char *My_strcat(char *dest, const char *src)
{
assert(dest && src != NULL);// Assertion
char *ret = dest;
while (*dest != '\0')//'\0' Of ASCLL The code value is 0
{
dest++;
}
//dest Pointing to '\0'
while (*dest++ = *src++)
{
;
}
/* amount to
while (*src != '\0')
{
*dest++ = *src++;
}*/
return ret;
}
int main(void)
{
char arr1[20] = "hello C";
char arr2[20] = "yuyan";
printf("%s\n", My_strcat(arr1, arr2));
return 0;
}

边栏推荐
猜你喜欢
Unity learning notes conversion between plane pixel coordinates of spherical panorama and coordinates on three-dimensional coordinate system
暑假打工 2 个 月,让我明白了 Keepalived 高可用的三种路由方案
Changsha big screen development
8 Redis 数据库管理
[postgraduate entrance examination vocabulary training camp] day 8 - complete, traditional, extra, aford, professional, required
相关系数矩阵可视化
Unity学习笔记 球形全景图平面像素坐标与三维坐标系上的坐标之间的转换
MySQL之知识点(十)
在线教育项目整合Swagger
JVM heap memory parsing
随机推荐
Redux最佳实践「Redux Toolkit」
[postgraduate entrance examination vocabulary training camp] day 8 - complete, traditional, extra, aford, professional, required
MySQL之知识点(十一)
剑指 Offer 11. 旋转数组的最小数字
pyspark里mapPartitions的用法
QT|QLabel显示多行文本过多后显示省略号
English语法_反身代词
开源轻量级工作流WorkflowCore介绍
MySQL之知识点(十)
网络层协议 ——— IP协议
数商云精细化工行业管理平台一体化信息化解决方案
Win10账户初始化配置
消息队列简介
[postgraduate entrance examination vocabulary training camp] day 9 - vital, dynamity, previous, pray, transit, virile, invent
JVM heap memory parsing
HAC集群修改为单机
查询某个表占用的空间大小以及表的数据量
Summer summary (I)
Flutter 苹果原生拼音键盘在TextField上输入异常 | 拼音输入过程回调问题
学习记录[email protected]之moveExecutionsToSingleActivityId并行网关或者包容网关回退