#include<stdio.h>
#include<stdlib.h>
#include<string.h>
void main()
{ char p[20]={'a','b','c','d'},q[]="abc",r[]="abcde";
strcat(p,r);
printf("p=%s\n",p);
strcpy(p+2,q); //将q的值赋值到p中,p+2表示保留2个字符
printf("p=%s",p);
system("pause");
}
1.strcpy在使用中赋值是将所有的字符串均复制过去,strcpy(p+2,q),p+2表示p中字符保留个数。
2.strcat(p,r)表示p字符串后面拼接r字符串。