strcpy函数实现,错哪里?
#include <stdio.h>#define null 0
void strcpy(char* s,char* p);
main()
{
const char* b="carl_berg";char* a;
a=(char*)malloc(sizeof(b));
clrscr();
strcpy(a,b);
printf("%s",a);
}
void strcpy(char* a,char* b)
{
if(b==null)
printf("b is null!");
else
{
while(*a++=*b++);
}
}
[此贴子已经被作者于2005-12-26 20:43:33编辑过]