title: Pointer to array of structures in C
body: <p>Please let me know how can I pass a pointer to the array of structures in C as a function argument.</p>
  
  <p>Below is my code.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include&lt;strings.h&gt;
  
  
  
  typedef struct _Alert
  {
      char   MerchantNo[21];
      time_t last_update;
  } Alert;
  typedef Alert *PALERT;
  
  
  int set(PALERT palertMerch[5], int *merchnoIndex, char * txnMerchant)
  {
      strcpy(palertMerch[*merchnoIndex]-&gt;MerchantNo, txnMerchant);
      *(merchnoIndex) = *(merchnoIndex) + 1 ;
  
      return 0;
  }
  
  int main()
  {
      Alert alert[5];
  
      for(int i =0; i&lt;5;i++)
      {
          memset(alert[i].MerchantNo, 0x00, 21);
          alert[i].last_update = (time_t)0;
      }
  
      char *p = "SACHIN";
      int index = 0;
      set(alert[5], index, p);
  }
  </code></pre>
  
  <p>Error message</p>
  
  <pre><code>"3.c", line 34: argument #1 is incompatible with prototype:
          prototype: pointer to pointer to struct _Alert {array[21] of char MerchantNo, long last_update} : "3.c", line 14
          argument : struct _Alert {array[21] of char MerchantNo, long last_update}
  "3.c", line 34: warning: improper pointer/integer combination: arg #2
  cc: acomp failed for 3.c
  </code></pre>