#include
#include
void main()
{char a[6]="hello",b[6]="world",c[20];int i=0;
do{
c[i]=a[i];i++;
}while(a[i]!='\0');
i=0;
do{c[(i)+strlen(a)]=b[i];i++;/*strlen()函数是求字符串个数不包含'\0'字符,如题strlen(a)的值就为5*/
}while(b[i]!='\0');
c[strlen(a)+strlen(b)]='\0';
printf("%s",c);
}
#include
#include
int main()
{
char *p = "Hello";
char *q = "World";
char together[20] = "";
strcat(together, p);
strcat(together, q);
printf("%s", together);
return 0;
}