Skip to content

Instantly share code, notes, and snippets.

@computermouth
Created June 1, 2017 18:08
Show Gist options
  • Save computermouth/13f3a1ff03f1bf69b256eaa89bc8752e to your computer and use it in GitHub Desktop.
Save computermouth/13f3a1ff03f1bf69b256eaa89bc8752e to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
typedef unsigned char rgba_t[4];
int main () {
char a[8];
memset(a, 70, 8);
char b[4] = {65, 66, 67, 68};
printf("a: %s\n", a);
printf("b: %s\n", b);
memcpy(a, b, 4);
printf("a: %s\n", a);
printf("b: %s\n", b);
memcpy(a+3, b, 4);
printf("a: %s\n", a);
printf("b: %s\n", b);
rgba_t pix = { 75, 75, 75, 75};
memcpy(a, pix, 4);
printf("a: %s\n", a);
printf("pix: %s\n", pix);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment