memcpy()和strcpy()有什么区别?我试图在程序的帮助下找到它,但两者都提供相同的输出。strcpy与memcpy
int main()
{
char s[5]={'s','a','\0','c','h'};
char p[5];
char t[5];
strcpy(p,s);
memcpy(t,s,5);
printf("sachin p is [%s], t is [%s]",p,t);
return 0;
}
输出
sachin p is [sa], t is [sa]
请参阅http://stackoverflow.com/questions/2884874/when-to-use-strncpy-or-memmove – 2010-05-24 16:29:44