Created
July 16, 2017 23:24
-
-
Save ruan65/8eaf9b4573b7f24cf55acb3c8d11e9c8 to your computer and use it in GitHub Desktop.
playing with clang
This file contains hidden or 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
#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