Is strncpy() a specialization of memcpy()?
问题 Just curious to know (as we use these functions often). I don't see any practical difference between strncpy() and memcpy(). Isn't it worth to say that effectively, char* strncpy (char *dst, const char *src, size_t size) { return (char*)memcpy(dst, src, size); } Or am I missing any side effect? There is one similar earlier question, but couldn't find an exact answer. 回答1: There is a difference, see this part of the strncpy page you linked to (emphasis mine): Copies the first num characters of