char *p = "hello";//5 个长度 int len = strlen(p)+ ; //char *str = (char *)malloc(sizeof(char)*len);
char str[] = "nihaoma";
//memset(str, 0, len);
//strcpy(str, p);
strcat(str, p);//str 必须有初始化
//memcpy(): 需要为 str 多分配一个空间,然后系统才能自动添加 \0
//memcpy(str, p, len);
len = strlen(str); printf("strlen(str):%d\n", len);
printf("%s\n", str); //char destination[25];
//char *blank = " ", *c = "C++", *Borland = "Borland"; ////strcpy 自动加 \0 那么后面使用 strcat 也不会影响
//strcpy(destination, Borland);
//strcat(destination, blank);
//strcat(destination, c); //printf("%s\n", destination); system("pause");