Created
May 7, 2012 04:41
-
-
Save nanki/2625961 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> | |
typedef union { | |
double d; | |
int i; | |
} union_t; | |
void dump_union(union_t u) { | |
unsigned char *c = (unsigned char *)&u; | |
int i; | |
for (i = 0; i < sizeof(union_t); i++) { | |
printf("%02x ", c[i]); | |
} | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment