title: In C: How to set a pointer to a structure member that is an array?
body: <p>How should I write my code to example a specific array index of an array that happens to be a member of a structure?  The following code is giving me problems.</p>
  <pre><code>// main.c
  
  void clean_buffers(void); // prototype
  
  struct DEV_STATUS {
      unsigned char ADDR;
      unsigned char DEV_HAS_DATA;
      unsigned char ETH_HAS_DATA;
      unsigned char DATA[20];
  };
  
  struct DEV_STATUS g_cmdQueue[60] = {0};
  
  void main(void) {
  
      clean_buffers();
  
      while (1) {
          ;// MCU tasks        
      }
  }
  
  void clean_buffers(void) {
      unsigned char theCount = 0;
      byte queIdx;
      for (queIdx = 0; queIdx &lt; 59; queIdx++) {
          struct DEV_STATUS *p_struct;
          unsigned char *p_data;
          p_struct = &amp;g_cmdQueue[queIdx];
          p_data = &amp;p_struct-&gt;DATA;
          p_struct-&gt;ADDR = 0;
          p_struct-&gt;DEV_HAS_DATA = 0;
          p_struct-&gt;ETH_HAS_DATA = 0;
          theCount = 0;
          while(*(p_data+theCount) != 0) {
              *(p_data+(theCount++)) = 0;
          }
      }    
  } // EOF main.c
  </code></pre>
  <p>I get a compiler error <em>&quot;struct/union member expected&quot;</em> on the following line:</p>
  <pre><code>p_data = &amp;p_struct-&gt;DATA;
  </code></pre>
  <p>How should I write a pointer if I was to access, for example, the specific value of structure member <code>DATA[3]</code>?  I'm confused, I thought that as <code>p_data = &amp;p_struct-&gt;DATA;</code> is defined, I should be able to get it by using <code>*(pdata+3)</code> but I guess I'm missing something.</p>