title: Pass anonymous struct as parameter in C
body: <p>I have the following line of c (carriage returns added for readability - they aren't in the code):</p>
  
  <pre class="lang-c prettyprint-override"><code>#define i2c_write(slave_addr, reg_addr, len, *data_ptr)
      twi_master_write(MPU_TWI, {
          .addr = reg_addr,
          .addr_length = 1,
          .buffer = *data_ptr,
          .length = len,
          .chip = slave_addr
      })
  </code></pre>
  
  <p>Where <code>twi_master_write()</code> is declared as:</p>
  
  <pre class="lang-c prettyprint-override"><code>uint32_t twi_master_write(Twi *p_twi, twi_packet_t *p_packet);
  </code></pre>
  
  <p>and <code>twi_packet_t</code> is declared as:</p>
  
  <pre class="lang-c prettyprint-override"><code>typedef struct twi_packet {
      uint8_t addr[3];
      uint32_t addr_length;
      void *buffer;
      uint32_t length;
      uint8_t chip;
  } twi_packet_t;
  </code></pre>
  
  <p>The parameters of <code>twi_write()</code> are all required to be of type <code>unsigned char</code>.</p>
  
  <p>When compiling, I receive the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>expected expression before '{' token
  </code></pre>
  
  <p>Is there a correct way to do what I'm trying to do here, or is it just not possible?</p>