c语言的数组拷贝问题!

来源:百度知道 编辑:UC知道 时间:2024/06/14 11:37:26
两个字符数组!把第2个数组拷贝到第一个数组里!然后输出第一个数组!(例:第一个数组hello,第二个数组world,拷贝之后第一个变成了helloworld!然后输出)

#include <stdio.h>
#include <string.h>
int main()
{
char a[20] = "hello", b[20] = "world";
strcat(b, a);
printf("%s\n", a);
return 0;
}

#include<stdio.h>
#include <string.h>
void main()
{

char a[20]="hello";//注意第一个数组要够大,能容下两串总和。
char b[10] = "world";

strcat(a,b); //字符串连接函数
printf("%s\n",a);
}

好多分哦