title: Why does a pointer to array need to be cast before being passed as parameter to a function with array type argument?
body: <p>In C99, why is it that declaring a variable <code>p</code> as pointer to array needs to be cast before it is passed as a parameter to a function with array type argument, but declaring a variable <code>p</code> as void pointer then casting it to a pointer to array can be passed as pointer to array to the same function?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int arreglo(int locArr[])
  {
      locArr[0]=1;
      printf("el arreglo es : %i\n",locArr[0]);
      return 0;
  }
  
  int main()
  {
      /* Declare a pointer p to array */
      int (*p)[];
  
      int manArr[10];
  
      p=&amp;manArr;   /* assign the adress of manArr as case below */
  
      /* Here passing pointer p is not allowed as expected,
         since our function has int* as argument */         
  
      /* so I need to do a casting */
      arreglo((int*)p);   
  }
  
  /* **But in this other main function**: */
  
  int main()
  {
      /* Declare a void pointer  */
      void *p=NULL;
  
      /* Do a casting from p to void to p to array */
      p=(int (*)[])p;
  
      int manArr[10];
  
      p=&amp;manArr;  /* assing the adress of the array manArr as in above case */
  
      /* Now given the pointer to array as parameter to function WORKS¡¡,
         why?. As before the function expects int* as argument not
         a pointer to an array */  
  
      arreglo(p);
  
  }
  </code></pre>