Created
October 14, 2014 22:44
-
-
Save osdouglas/7b765d4d5ec53566e8f3 to your computer and use it in GitHub Desktop.
Testing unions
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 | |
{ | |
short s; | |
char c; | |
} | |
sc; | |
int main( void ) | |
{ | |
sc u; | |
u.s = 0x602; | |
printf( "%d\n", u.c ); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment