title: Dynamic array and void pointers
body: <p>I have quite peculiar problem. I want initialize an array pointed by a void pointer to which memory is allocated using new as shown below. </p>
  
  <pre><code>const int ARRAY_SIZE = 10;
  void InitArray()
  {
      int *ptrInt = new int[ARRAY_SIZE];
      for(int i=0; i&lt;ARRAY_SIZE;i++)
      {
           ptrInt[i] = 1; //OK
      }
  
      void *ptrVoid = new int[ARRAY_SIZE];
      for(int i=0; i&lt;ARRAY_SIZE;i++)
      {
           *(int*)ptrVoid[i] = 1; //Culprit  : I get a compiler error here 
                                  //(error C2036: 'void *' : unknown size)
      }
  }
  </code></pre>
  
  <p>Now, I want to initialize the elements of this array which is pointed by <code>ptrVoid</code> with say 1. How do I go about it? With this code I get a compiler error as shown in the code(I am using VS 2010). Any suggestions?</p>