Related functions: bcopy (),
Memccpy (),
Memmove (), Strcpy (), strncpy ()
Header file: # include <string. h>
Define function: void * memcpy (void * DEST, const void * SRC, size_t N)
Function Description: memcpy () is used to copy the first n Bytes of memory content in SRC to the memory address in DeST.
Unlike strcpy (), memcpy () completely copies n Bytes and does not end with the string ending '\ 0'.
Return Value: returns the pointer to the DeST.
Additional instructions:
The memory areas specified by the SRC and DEST pointers cannot overlap.
-------------------------------------------------------
# Include <string. h>
# Include <stdio. h>
Int main ()
{
Char A [30] = "strIng ()";
Char B [30] ="Hi \ 0Zengxiaolong ";
Int I;
Strcpy (A, B); // A [30] ="Hi \ 0ing ()"
Printf ("strcpy ():");
For (I = 0; I <30; I ++)
Printf ("% C", a [I]); //HiIng ()
Memcpy (a, B, 30); // A [30] = "Hi \ 0 zengxiaolong"
Printf ("\ nmemcpy ():");
For (I = 0; I <30; I ++)
Printf ("% C", a [I]); //HiZengxiaolong
Printf ("\ n I = % d \ n", I); // 30
}