title: C: typedef union
body: <p>didn't find anything in related questions. Most probably it's super noob, but I'll ask anyway/ I've got the following in my .h file:</p>
  
  <pre><code>typedef union _API_Packet_0x90{
      uint8_t packet[26];
      struct _pack_struct {
          uint8_t start;
          uint8_t length[2];
          uint8_t addr64[8];
          uint8_t addr16[2];
          uint8_t options;
          uint8_t rfData[4];
          uint8_t chksum;
      };
  } API_Packet_0x90;
  
  API_Packet_0x90 ap90;
  </code></pre>
  
  <p>This is code for a microcontroller, I'm using xc8 toolchain (former Hi Tech C). The compiler says:</p>
  
  <blockquote>
    <p>xbee_api.h:19: warning: missing basic type; int assumed<br>
      xbee_api.h:19:
    error: ";" expected<br>
    xbee_api.h:19: warning: missing basic type; int  assumed<br>
    xbee_api.h:21: warning: missing basic type; int assumed   </p>
  </blockquote>
  
  <p>, and this goes on (too many errors)</p>
  
  <p>I thought it's uint8_t, so I added <code>#include &lt;ctypes.h&gt;</code>. Nope. I thought it is about names, so I tried all kinds of plays such as</p>
  
  <pre><code>typedef union {
      uint8_t packet[26];
      struct _pack_struct {
  
      };
  } API_Packet_0x90;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>typedef union {
      uint8_t packet[];
      struct _pack_struct {
  
      };
  } API_Packet_0x90;
  </code></pre>
  
  <p>or others. Nothing helps. I'm stuck as I believe I'm following syntax properly. Any help?</p>