Char *s1= "HelloWorld ";
Char * s2[16];
strcpy(s1,s2);
也有另外好多方法可以实现把s1的内容拷贝到s2中,比如:
(1)
int len = strlen(s1);
for(int i = 0; i < len; ++i)
{
s2[i] = s1[i];
}
(2)
int len =strlen(s1);
memcpy(s1, s2, len + 1);
(3)
sprintf(s2,"%s ", s1);
(4)
char* p = s2;
char* q = s1;
while(*p++ = *q++) ;
(5)
s2[0] = '\0';
strcat(s2, s1);