beautypg.com

Memcpy, Memmove, Memset – Zilog ZUSBOPTS User Manual

Page 456: Memcpy memmove memset, Synopsis, Returns, Example

background image

Standard Functions

UM017105-0511

428

Zilog Developer Studio II – ZNEO™
User Manual

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, const 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.

Copying between objects that overlap takes place correctly.

Synopsis

#include

void *memmove(void *s1, const 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: