一、函数原型数组
void *memcpy(void *destin,void *source,unsigned n);函数
其中,spa
该函数返回一个指向目标存储区destin的指针。若是destin存在数据,将会被覆盖。该函数存在与头文件string.h中。指针
二、实现的功能code
从source所指的内存地址的起始位置开始拷贝n个字节到目标destin所指的内存地址的起始位置中。blog
三、memcpy与strcpy区别:内存
四、程序案例:字符串
#include<stdio.h> #include<string.h> #include<stdlib.h> #define N 9 int main() { char* a=(char*)malloc(sizeof(char)*N); char* b="Who are you?"; memcpy(a,b,N); printf("%s\n",a); return 0; }
运行结果:原型
Who are y
string