Skip to content

Instantly share code, notes, and snippets.

@eatnumber1
Created October 7, 2013 19:31
Show Gist options
  • Save eatnumber1/6873590 to your computer and use it in GitHub Desktop.
Save eatnumber1/6873590 to your computer and use it in GitHub Desktop.
#include <stdint.h>
#include <stdio.h>
#include <string.h>
int main() {
unsigned char foo_arr[9];
memset(foo_arr, 0, 9);
unsigned char *foo = foo_arr;
uint8_t a = 0xDE;
uint64_t b = 0xDEEFBEADDEEFBEADLL;
*((uint64_t *) (foo + 1)) = b, *foo = a;
printf("[");
for( int i = 0; i < 9; i++ ) {
printf("0x%x", foo[i]);
if( i != 8 ) printf(", ");
}
printf("]\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment