
不是很懂这个题目想表达的意思,一般一个字符串数组不是只有结尾的一个'\0'吗?怎么感觉好像s2数组可以有很多个'\0',亦或者说'\0'能放在数组中间其前后有其它字符似的。

供参考:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char s1[30], s2[30]="abcd\0ef\0g\0h";//定义两个字符数组用于存放字符串;
int i,len;
//gets(s2);
printf("字符串s2为:%s\n", s2); //输出该字符串s2
len = strlen(s2);
for (i = 0; i <= len; i++)
s1[i] = s2[i];
printf("复制后串为:%s\n", s1);
return 0;
}