头文件:
#include <string.h>函数原型:
char *strcat (char *dest,const char *src)函数描述:
strcat()会将参数src字符串拷贝到参数dest所指的字符串尾,第一个参数dest要有足够的空间来容纳要拷贝的字符串;
返回值:
返回dest字符串参数的起始地址;
例子:
#include <string.h>
#include <stdio.h>
int main(void)
{
char dest[30] = "Hello";
char src[] = "World";
strcat(dest, src);
printf("dest:[%s]\n", dest);
return 0;
}得到的结果是:dest:[HelloWorld]
本文详细介绍了C语言中strcat函数的使用方法,包括其头文件包含、函数原型、功能描述及返回值说明,并通过一个具体示例展示了如何使用strcat连接两个字符串。
490





