Keil Logo

memcpy

Summary
#include <string.h>

void *memcpy (
  void *dest,          /* destination buffer */
  const void *src,     /* source buffer */
  unsigned int len);   /* bytes to copy */
Description

The memcpy function copies len bytes from src to dest. If these memory buffers overlap, the memcpy function cannot guarantee that bytes in src are copied to dest before being overwritten. If these buffers do overlap, use the memmove function.

Return Value

The memcpy function returns dest.

See Also

memccpy, memchr, memcmp, memmove, memset

Example
#include <string.h>
#include <stdio.h> /* for printf */

void tst_memcpy (void) {
  char src1 [100] = "Copy this string to dst1";
  char dst1 [100];
  char *p;

  p = memcpy (dst1, src1, sizeof (dst1));
  printf ("dst = \"%s\"\n", p);
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.