'\" t .\" Copyright, Free Software Foundation .\" Copyright 2002, Walter Harms .\" Copyright, the authors of the Linux man-pages project .\" .\" SPDX-License-Identifier: GPL-1.0-or-later .\" .TH mempcpy 3 2026-08-10 "Linux man-pages 6.19" .SH NAME mempcpy \- memory return-offset-pointer copy .SH LIBRARY Standard C library .RI ( libc ,\~ \-lc ) .SH SYNOPSIS .nf .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" .BR #include\~ " // see memory.h(3head)" .P .BR "void *mempcpy(" "size_t n;" .BI " void " dest "[restrict " n "], const void " src "[restrict " n ], .BI " size_t " n ); .fi .SH DESCRIPTION This function is similar to .BR memcpy (3), but it returns a pointer to one past the last written byte. .P It is equivalent to .P .in +4n .EX memcpy(dest, src, n) + n .EE .in .SH RETURN VALUE .I dest + .IR n . .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ .na .nh .BR mempcpy () T} Thread safety MT-Safe .TE .SH STANDARDS GNU. .SH HISTORY glibc 2.1. .SH EXAMPLES .EX 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; } .EE .SH SEE ALSO .BR memory.h (3head), .BR memccpy (3), .BR memcpy (3), .BR wmempcpy (3)