title: How to create a union with a 32 bit int and four 8 bit char types that each refer to difference slice of the 32 bit int?
body: <p>I want to create a union in which the biggest member is a 32 bit integer. This is what will be mainly written to. Then there are four 8 bit variables, probably char types that will each refer to a different section of the 32 bit integer kind of like:</p>
  
  <pre><code>   union {
     int32 myint;
     char char1 [7:0];
     char char2 [15:8];
     char char3 [23:16];
     char char4 [31:24];
     }
  </code></pre>
  
  <p>But I am not sure how to do this in C++.</p>