#include <stdio.h>
#include <string.h>
int main(void)
{
char src[] = "12345";
char dest[] = "1234";
printf("destination before memcpy: %s\n", dest);
memcpy(dest, src, strlen(src));
printf("destination after memcpy: %s\n %d ", dest,strlen(dest));
return 0;
}
/***** result ******/
/*
destination before 1234
destination after 1234512345
10
*/
内存结构 [1] [2] [3] [4] [\0] [1] [2] [3] [4] [5] [\0]
dest src