beautypg.com

Memcpy, Memmove, Memset – Zilog EZ80F916 User Manual

Page 371: Memcpy memmove memset

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

351

Example

char s1[]="COMPASS";
char s2[]="IDE";
int res;
res=memcmp(s1, s2, sizeof (char));

memcpy

Copies n characters from the object pointed to by s2 into the object pointed to by s1. If the
two regions overlap, the behavior is undefined.

Synopsis

#include
void *memcpy(void *s1, void *s2, size_t n);

Returns

The value of s1.

Example

char s1[10];
char s2[10] = "COMPASS";
memcpy(s1, s2, 8);

memmove

Moves n characters from the object pointed to by s2 into the object pointed to by s1. Copy-
ing between objects that overlap takes place correctly.

Synopsis

#include
void *memmove(void *s1, void *s2, size_t n);

Returns

The value of s1.

Example

char s1[10];
char s2[]="COMPASS";
memmove(s1, s2, 8*sizeof(char));

memset

Copies the value of c (converted to an

unsigned char

) into each of the first n characters

of the object pointed to by s.

This manual is related to the following products: