Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #pragma pack(push, 1)
- struct test
- {
- bool b1:1;
- bool b2:1;
- bool b3:1;
- bool b4:1;
- bool b5:1;
- bool b6:1;
- bool b7:1;
- bool b8:1;
- };
- #pragma pack(pop)
- int main()
- {
- test t;
- *(bool*)(&t) = 0;
- t.b1 = 1;
- t.b2 = 0;
- t.b3 = 1;
- t.b4 = 0;
- t.b5 = 1;
- t.b6 = 0;
- t.b7 = 1;
- t.b8 = 0;
- std::cout << t.b1 << " " << t.b2 << " " << t.b3 << " " << t.b4;
- std::cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment