原函数strcat:
char *strcat(char *dest, const char *src)
函数说明strcat:char *strcat(char *dest, const char *src) src 指向结尾的字符串的字符串附加到指向dest。
参数
dest -- 是目标数组strcat,它应该包含一个C字符串,大到足以包含级联的结果字符串的指针。src -- 是要追加的字符串。返回值
函数返回一个指针生成的字符串dest。
如何使用strcat() 函数:
#include <stdio.h>
#include <string.h>
int main () {
char src[50], dest[50];
strcpy(src, "This is src");
strcpy(dest, "This is dest");
strcat(dest, src);
printf("Final destination string : %s", dest);
return(0);
}
编译和运行上面的程序,产生如何下结果:
Final destination string : This is destThis is src