strcpy vs. memcpy
问题 What is the difference between memcpy() and strcpy() ? I tried to find it with the help of a program but both are giving the same output. 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; } Output sachin p is [sa], t is [sa] 回答1: what could be done to see this effect Compile and run this code: void dump5(char *str); int main() { char s[5]={'s','a','\0','c','h'}; char membuff[5]; char strbuff[5]