回复 10楼 yangang2
提示: 作者被禁止或删除 内容自动屏蔽
2010-09-27 00:41
2010-09-27 06:12
程序代码:#include <iostream>
using std::cout;
using std::endl;
char *strcpy(char* strDest ,const char* strSrc);
int main ()
{
char adress[ ]="String Copy";
char Dst [ ]="Why fdfefdsfefsdf";
cout<<strcpy(Dst,adress)<<endl;
system ("Pause");
return 0;
}
char *strcpy(char* strDest ,const char* strSrc)
{
if ( *strDest == NULL || *strSrc == NULL )
{
cout<<"strDest == NULL || strSrc == NULL"<<endl;
}
while ( (*strDest++ = *strSrc++ ) != '\0' )
{
;
}
return strDest;
}
主要原因是目标字符串的长度没有源字符串的长.....
2010-09-27 06:19
2010-09-27 18:19

2010-09-30 20:19
2010-09-30 20:53