strcpy的两端程序输出不同 求解
林初茵 2008-12-22 12:53:17 为什么第一个被截断 第二个程序不被截断
程序1:
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void)
{
char s[]="123456789";
char d[]="123";
strcpy(d,s);
printf("%s,\n%s",d,s);
return 0;
}
输出
123456789,
56789
程序1:
#include <iostream>
#include <stdio.h>
using namespace std;
int main(void)
{
char s2[]="123456789";
char d2[]="1234";
strcpy(d2,s2);
printf("%s,\n%s",d2,s2);
return 0;
}
输出
123456789,
123456789