Created
June 1, 2017 18:08
-
-
Save computermouth/13f3a1ff03f1bf69b256eaa89bc8752e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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