View Code
#include <stdio.h>
#include <string.h>
int main()
{
char a[5] = "ABCD";
char b[8] = "abcdefg";
char c[8] = "abcdefg";
char d[5] = "ABCD";
strcpy(a,b); //长的复制给短的
strcpy(c,d);//短的复制给长的
printf("%d\n",strlen(a));//a的长度直接增加了
printf("%s\n",a);
printf("%s\n",c);
}