The following is the result of man memcpy:
# Include <string. h>
Void * memcpy (void * DEST, const void * SRC, size_t N );
Description
The memcpy () function copies n Bytes from memory area SRC to memory
Area DeST. The memory areas must not overlap. Use memmove (3) if
Memory areas do overlap.
Memcpy and memmove
Memmove is used to handle the overlap between the buckets pointed to by Src and DeST. Therefore, it uses a temporary array to copy SRC to a temporary array, and then copy the temporary array to DeST, in this way, there will be no errors even if there is overlap, which also requires a cost. Therefore, memcpy should be used if there is no overlap.
Memcpy, strcpy
Strcpy is mainly used to copy strings, while memcpy can copy any type. Of course, it doesn't care what type to copy. It is a whole block copy based on memory data. The main difference between the two is that strcpy 'ends with \ 0', while memcpy does not end, so you need to specify the copy size.