C语言字符函数----strcat(字符串拼接)
函数名:strcat
功 能:字符串拼接
举 例:将first_str与second_str进行拼接!
#include<string.h>
#include<stdio.h>
int main()
{
char first_str[20]=“hello “;
char *second_str=” world”;
printf(“原字符串—%s\n”,first_str);
strcat(first_str,second_str);
printf(“拼接后字符串—%s\n”,first_str);
return 0;
}
结果为:

本文详细介绍了C语言中strcat函数的使用方法,通过示例展示了如何将两个字符串进行拼接。首先定义了第一个字符串,然后使用strcat函数将其与第二个字符串连接起来,最后输出拼接后的结果。
2314

被折叠的 条评论
为什么被折叠?



