memmove.c
来自「标准c库代码,可以应用于各个系统提供了大量的基本函数」· C语言 代码 · 共 70 行
C
70 行
/*FUNCTION <<memmove>>---move possibly overlapping memoryINDEX memmoveANSI_SYNOPSIS #include <string.h> void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>);TRAD_SYNOPSIS #include <string.h> void *memmove(<[dst]>, <[src]>, <[length]>) void *<[dst]>; void *<[src]>; size_t <[length]>;DESCRIPTION This function moves <[length]> characters from the block of memory starting at <<*<[src]>>> to the memory starting at <<*<[dst]>>>. <<memmove>> reproduces the characters correctly at <<*<[dst]>>> even if the two areas overlap.RETURNS The function returns <[dst]> as passed.PORTABILITY<<memmove>> is ANSI C.<<memmove>> requires no supporting OS subroutines.QUICKREF memmove ansi pure*/#include <string.h>/*SUPPRESS 20*/_PTR_DEFUN (memmove, (dst_void, src_void, length), _PTR dst_void _AND _CONST _PTR src_void _AND size_t length){ char *dst = dst_void; _CONST char *src = src_void; if (src < dst && dst < src + length) { /* Have to copy backwards */ src += length; dst += length; while (length--) { *--dst = *--src; } } else { while (length--) { *dst++ = *src++; } } return dst_void;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?