Skip to content

Instantly share code, notes, and snippets.

@munen
Created February 14, 2011 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save munen/825864 to your computer and use it in GitHub Desktop.
Save munen/825864 to your computer and use it in GitHub Desktop.
memcpy demo
#include <stdio.h>
int main() {
char source[] = "Foobar123";
char * target;
target = (char *) malloc(sizeof(source));
memcpy (target, source+1, sizeof(source));
// prints: "oobar123"
printf("%s", target);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment