SHARE
TWEET

Untitled

a guest Jul 16th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct MessageBig{
  5.   unsigned long long unused:64;
  6. };
  7.  
  8. struct Message1{
  9.   unsigned a:7;
  10.   unsigned b:12;
  11. };
  12.  
  13. union Message{
  14.   MessageBig messageBig;
  15.   Message1 message1;
  16. };
  17.  
  18. int main() {
  19.   Message1 m1 = {'a', 3014};
  20.   Message m;
  21.   m.message1 = m1;
  22.     cout<<(char)m.message1.a<<" "<<(unsigned int)m.message1.b<<endl;
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top