Last active
December 17, 2015 19:39
-
-
Save khajavi/5662424 to your computer and use it in GitHub Desktop.
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdbool.h> | |
struct A { | |
bool a:1; | |
bool b:1; | |
bool c:1; | |
bool d:1; | |
}; | |
struct B { | |
int a; | |
}; | |
int main() { | |
struct A* pa = malloc( sizeof(struct A) ); | |
struct B* pb = (struct B*) pa; | |
pa->a = 0; | |
pa->b = 1; | |
pa->c = 1; | |
pa->d = 0; | |
printf("value of pb->a is %i\n", pb->a); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment