memory.h(3head) — Linux manual page

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | VERSIONS | STANDARDS | HISTORY | SEE ALSO | COLOPHON

memory.h(3head)                                           memory.h(3head)

NAME         top

       memory.h - memory operations

LIBRARY         top

       Standard C library (libc, -lc)

SYNOPSIS         top

       #include <memory.h>

DESCRIPTION         top

   Write
       bzero(3)
       explicit_bzero(3)
       memset(3)
       memset_explicit(3)

   Copy
       memmove(3)
       memcpy(3)
       mempcpy(3)
       memccpy(3)
       strncpy(3)
       stpncpy(3)

   Catenate
       strncat(3)

   Duplicate
       strndup(3)
       strndupa(3)

   Compare
       memeq(3)
       memcmp(3)
       strncmp(3)
       strncasecmp(3)

   Search
       memchr(3)
       memrchr(3)
       memmem(3)

VERSIONS         top

       In some systems (Illumos), <memory.h> contains only a few of these
       functions, and thus <string.h> is needed.

STANDARDS         top

       BSD.

       These functions are also provided in <string.h>, as specified by
       ISO C.  This is a historic mistake maintained for compatibility
       reasons; these functions aren't string APIs.

HISTORY         top

       SVr1, 4.3BSD.

       System V (1983) introduced an initial set of mem* functions in a
       <memory.h> header file.  4.3BSD (1986) adopted them.

       SVID Issue 1 (1985) standardized this header file, but stated that
       the functions would be moved to <string.h>.

       XPG Issue 3 (1989) listed <memory.h> as WITHDRAWN, and stated that
       the functions had been moved to <string.h>.

       C89 didn't standardize this header file and instead specified all
       these functions in <string.h>.

       This merge of header files has historically confused programmers
       about the real purpose of these functions.

       Most C libraries, including the BSDs, glibc, musl, Bionic, and
       Illumos continue to provide <memory.h>.

       gnulib doesn't provide it, though, and instead uses <string.h>.

SEE ALSO         top

       string(3), string_copying(7)

COLOPHON         top

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.19.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2026-09-09.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       man-pages@man7.org

Linux man-pages 6.19            2026-08-10                memory.h(3head)

Pages that refer to this page: bcopy(3)bzero(3)explicit_bzero(3)memccpy(3)memchr(3)memcmp(3)memcpy(3)memfrob(3)memmem(3)memmove(3)mempcpy(3)memrchr(3)memset(3)memset_explicit(3)stpncpy(3)string(3)strncasecmp(3)strncat(3)strncmp(3)strncpy(3)strndup(3)strndupa(3)strnlen(3)swab(3)