memcpy(内存拷贝函数)
void* memcpy(void* destination, const void* source, size_t num);
void* dest 目标内存 const void* src 源内存 size_t num 字节个数
库中实现的memcpy函数
struct {
char name[40];
int age;
} person, person_copy;
int main()
{
char myname[] = "Pierre de Fermat";
/* using memcpy to copy string: */
memcpy(person.name, myname, strlen(myname) + 1);
person.age = 46;
/* using memcpy to copy structure: */
memcpy(&person_copy, &person, sizeof(person));
printf("person_copy: %s, %d \n", person_copy.name, person_copy.age);
system("pause");
return 0;
}