void insert(char *string1,char *string2 ,int location)
{
char ch[strlen(string1) + strlen(string2 )];
memset(ch,'0',strlen(string1) + strlen(string2 ));
for (int i = 0; i < location; ++i) {
ch[i] = string1[i];
}
for (int i = 0; i < strlen(string2) ; ++i) {
ch[location + i] = string2[i];
}
for (int i = 0; i < strlen(string1) - location; ++i) {
ch[location + strlen(string2) + i] = string1[location + i];
}
puts(ch);
}
int main()
{
char str1[100] ,str2[100];
char *rec;
int num;
scanf_s("%d",&num);
getchar();
gets(str1);
gets(str2);
insert(str1,str2,num);
return 0;
}
为什么每次输出都会有一个垃圾数啊
后面莫名其妙多了一个问号,这是为什么