{
while (*destination)
{
destination++;
}
while (*source)
{
*destination = *source;
destination++;
source++;
}
*destination = *source;
}
遍历到 destination 的尾部后需要开辟空间,已经到数组尾部了再继续赋值自加肯定会出错。
要看你调用这个函数的代码才知道
Run-Time Check Failure #2 - Stack around the variable 'arr1' was corrupted. 这个错误提示,不在上面这段代码里。
主要是你怎么调用的?