title: access union member in c
body: <p>I have a question about union in c language</p>
  
  <p>for example:</p>
  
  <pre><code>typedef struct {
      int a;
       float c;
  }Type1;
  
  
  typedef struct {
      int b;
       char d;
  }Type2;
  
  union Select {
      Type1 type1;
      Type2 type2;
  };
  
  
  void main() {
      Select* select;
      //can we access type1 first and then access type2 immediately? like this way:
      select-&gt;type1.a;
      select-&gt;type2.b;
  </code></pre>
  
  <p>//after access type1, and then access type2 immediately, can  we get the value b of type2?
  //I modify the first post a little bit, because it is meanless at the beginning.</p>
  
  <p>}</p>