memory(3)memory(3)Name
memccpy, memchr, memcmp, memcpy, memmove, memset - memory operations
Syntax
#include <string.h>
void *memccpy (s1, s2, c, n)
void *s1, *s2;
int c;
size_t n;
void *memchr (s, c, n)
void *s;
int c;
size_t n;
int memcmp (s1, s2, n)
void *s1, *s2;
size_t n;
void *memcpy (s1, s2, n)
void *s1, *s2;
size_t n;
void *memset (s, c, n)
void *s;
int c;
size_t n;
void *memmove (s1, s2, n)
void *s1, *s2;
size_t n;
Description
These functions operate efficiently on memory areas (arrays of charac‐
ters bounded by a count, not terminated by a null character). They do
not check for the overflow of any receiving memory area.
The subroutine copies characters from memory area s2 into s1, stopping
after the first occurrence of character c has been copied, or after n
characters have been copied, whichever comes first. It returns a
pointer to the character after the copy of c in s1, or a NULL pointer
if c was not found in the first n characters of s2.
The subroutine returns a pointer to the first occurrence of character c
in the first n characters of memory area s, or a NULL pointer if c does
not occur.
The subroutine compares its arguments, looking at the first n charac‐
ters only, and returns an integer less than, equal to, or greater than
0, according as s1 is lexicographically less than, equal to, or greater
than s2.
The subroutine copies n characters from memory area s2 to s1. It
returns s1.
The subroutine is like , except that if s1 and s2 specify overlapping
areas, works as if an intermediate buffer is used.
The subroutine sets the first n characters in memory area s to the
value of character c. It returns s.
Restrictions
The subroutine uses native character comparison, which is signed on
PDP-11s, unsigned on other machines.
Character movement is performed differently in different implementa‐
tions of and Thus overlapping moves, using these subroutines, may yield
unpredictable results.
memory(3)