#include <iostream>
#include <stdio.h>
int main(void)
{
char s[]="123456789";
char d[]="123";
strcpy(d,s);
printf("%s,%s",d,s);
return 0;
}
结果:
123456789,56789
解析:
在内存中分配如下:
copy前 copy后
b->1 ------> 1
2 2
3 3