strcpy函数的原型为:char *strcpy(char *strDest,const char *strSrc)
char *strcpy(char *strDest,const char *strSrc)
{
assert((strDest != NULL) && (strSrc != NULL));
char *address = strDest;
while((*strDest++ = *strSrc++) != '\0')
return 0;
retrun address;
}
memcpy函数原型:char *memcpy(char *to, const char *from, size_t size)
char *memcpy(char *to, const char *from, size_t size)
{
assert((to != NULL) && (from != NULL));
//防止to和from的地址发生改变
char *pto = to;
char *pfrom = from ;
while(size-- > 0)
{
*pto++ = *from++;
}
return pto;
}
3773




被折叠的 条评论
为什么被折叠?



