title: How to declare array of structs in C
body: <p>I am having trouble declaring an array of structs prior to populating them with data.</p>
  
  <p>My struct looks like this:</p>
  
  <pre><code>typedef struct {
    uint8_t * p_data;     ///&lt; Pointer to the buffer holding the data.
    uint8_t   length;     ///&lt; Number of bytes to transfer.
    uint8_t   operation;  ///&lt; Device address combined with transfer direction.
    uint8_t   flags;      ///&lt; Transfer flags (see @ref NRF_TWI_MNGR_NO_STOP).
  } nrf_twi_mngr_transfer_t;
  </code></pre>
  
  <p>And in my code I am trying to declare the array like this:</p>
  
  <pre><code>struct nrf_twi_mngr_transfer_t start_read_transfer[10];
  </code></pre>
  
  <p>However I get a compile error:</p>
  
  <blockquote>
    <p>array type has incomplete element type 'struct nrf_twi_mngr_transfer_t'</p>
  </blockquote>
  
  <p>I have searched around as I thought should be a common thing, but I can't figure out what I am doing wrong. Maybe because one of the elements is a pointer?  But that pointer should be a fixed size right?</p>
  
  <p>Many thanks</p>