Skip to content

Instantly share code, notes, and snippets.

@ruan65
Created July 16, 2017 23:24
Show Gist options
  • Save ruan65/8eaf9b4573b7f24cf55acb3c8d11e9c8 to your computer and use it in GitHub Desktop.
Save ruan65/8eaf9b4573b7f24cf55acb3c8d11e9c8 to your computer and use it in GitHub Desktop.
playing with clang
#import <stdio.h>
typedef unsigned char *pointer;
void show_bytes(pointer start, int len) {
int i;
for(i = 0; i < len; i++) {
printf("%p\t0x%.4x\n", start + i, start[i]);
}
printf("\n");
}
int main() {
int a = 257;
printf("int a = %d\n", a);
show_bytes( (pointer) &a, sizeof(int));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment