C语言中strcat是干什么用的,他是什么呢

谢谢。

strcat 语法: #include <string.h> char *strcat( char *str1, const char *str2 );功能:函数将字符串str2 连接到str1的末端,并返回指针str1. 例如: printf( "Enter your name: " ); scanf( "%s", name ); title = strcat( name, " the Great" ); printf( "Hello, %s\n", title ); 不明白再追问
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-12-18
哈哈,粘别人的=============字符串连接函数,函数返回指针,两个参数都是指针.第一个参数所指向的内存的地址必须能容纳两个字符串连接后的大小.
#include <stdio.h>
#include <string.h>//这一句一定要加,包含了strcat的源代码
main()
{
char s1[]="hello",s2[]="programs";
strcat(s1,s2);
printf("%s\n",s1);//输出 helloprograms
}
第2个回答  2013-12-18
刚才我们团队的一位队员回答的很详细了,其实就是连接字符串的函数,这是语法部分,只要理解实质就好。
相似回答