mempcpy(3)

mempcpy3

Memory return-offset-pointer copy

Usage

#define _GNU_SOURCE         /* See feature_test_macros(7) */
#include <string.h>  // see memory.h(3head)

void *mempcpy(size_t n; void dest[restrict n], const void src[restrict n], size_t n);

Library

Standard C library (libc, -lc)

Overview

This function is similar to memcpy(3), but it returns a pointer to one past the last written byte.

It is equivalent to

memcpy(dest, src, n) + n

Return value

dest + n.

Attributes

For an explanation of the terms used in this section, see attributes(7).

InterfaceAttributeValue
mempcpy()Thread safetyMT-Safe

Examples

void *
combine(void *o1, size_t s1, void *o2, size_t s2)
{
    void *result = malloc(s1 + s2);
    if (result != NULL)
        mempcpy(mempcpy(result, o1, s1), o2, s2);
    return result;
}

Releases

12 releases since Debian 3.1 (Sarge); the text changed 11 times.

  1. 3.1
  2. 4.0
  3. 5.0
  4. 6.0
  5. 7
  6. 8
  7. 9
  8. 10
  9. 11
  10. 12
  11. 13
  12. Arch

Standards

GNU.

History

glibc 2.1.

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.