title: Array type casting in C
body: <p>I have a program as given below, and I am learning type casting in C.  Here I am trying to cast void* into int*. But the compiler is throwing an error saying &quot;<code>error: operand of type 'void' where arithmetic or pointer type is required - printf(&quot;%d\n&quot;,(int *)(a[2]));</code>&quot;</p>
  <p>Appreciate your help to do this type casting.</p>
  <pre><code>#include &lt;stdio.h&gt;
  
  void printArray(void* a){
          printf(&quot;%d\n&quot;,(int *)(a[2]));
  
  }
  
  int main(){
          int a[] = {1,2,3,4};
          printArray(a);
          return 0;
  }
  </code></pre>