函数名:memmove
头文件:<mem.h>
函数原型: void *memmove(void *des,void *suc,unsigned m);
功能:从源区域移动m个字节到目标区域
参数: void* des 为要移动的目标区域
void* suc 为要移动的源区域
unsigned m 为要移动的字节数
返回值:返回指向des的指针
程序例:从源区域s移动7个字节到目标区域。
#include<stdio.h> #include<mem.h> #include<string.h> int main(void){ char *suc="@@@@@@@@@@@@@@@@@@@@@"; char des[40]={"I love www.dotcpp.com"}; printf("destination before memmove: %s\n",des); char *p=(char*)memmove(des,suc,7); printf("destination after memmove: %s\n",des); return 0; }
运行结果
destination before memmove: I love www.dotcpp.com destination after memmove: @@@@@@@www.dotcpp.com
本文固定URL:https://www.dotcpp.com/course/494