English
Language : 

CC78K0S Datasheet, PDF (234/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 10 LIBRARY FUNCTIONS
6-1 memcpy
memmove
Character String/Memory Functions
FUNCTION
The memory function memcpy copies a specified number of characters from a source area of memory to a
destination area of memory.
The memory function memmove is identical to memcpy, except that it allows overlap between the source and
destination areas.
HEADER
string.h
FUNCTION PROTOTYPE
void *memcpy (void *s1, const void *s2, size_t n);
void *memmove (void *s1, const void *s2, size_t n);
Function
memcpy,
memmove
Arguments
s1 ... Pointer to object into
which data is to be copied
s2 ... Pointer to object
containing data to be copied
n ... Number of characters to
be copied
Return Value
Value of s1
EXPLANATION
memcpy
• The memcpy function copies n number of consecutive bytes from the object pointed to by s2 to the object
pointed to by s1.
• If s2<s1<s2+n (s1 and s2 overlap), the memory copy operation by memcpy is not guaranteed (because
copying starts in sequence from the beginning of the area).
memmove
• The memmove function also copies n number of consecutive bytes from the object pointed to by s2 to the
object pointed to by s1.
• Even if s1 and s2 overlap, the function performs memory copying properly.
234
User’s Manual U14872EJ1V0UM