Skip to content

Instantly share code, notes, and snippets.

@zhuomingliang
Created December 24, 2014 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuomingliang/6c25e5aadcfcf4d538ad to your computer and use it in GitHub Desktop.
Save zhuomingliang/6c25e5aadcfcf4d538ad to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdint.h>
typedef union {
int64_t c;
struct {
int32_t a;
int16_t b;
} r;
} t;
int main() {
t test;
test.r.a = 23;
test.r.b = 32;
t test2;
test2.r.a =23;
test2.r.b =32;
if(test.r == test2.r) {
printf("1\n");
}
printf("%ld\n", test.c);
printf("%ld", test2.c);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment