### Question 11.25

What's the difference between `memcpy` and `memmove`?

`memmove` offers guaranteed behavior if the source and destination arguments overlap. `memcpy` makes no such guarantee, and may therefore be more efficiently implementable. When in doubt, it's safer to use `memmove`.

References: K&R2 Sec. B3 p. 250
ANSI Sec. 4.11.2.1, Sec. 4.11.2.2
ISO Sec. 7.11.2.1, Sec. 7.11.2.2
Rationale Sec. 4.11.2
H&S Sec. 14.3 pp. 341-2
PCS Sec. 11 pp. 165-6

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback