Freeing memory with Pointer Arithmetic
<p>C++ newb here. I'm trying to write my own implementation of an array using only pointers, and I've hit a wall I don't know how to get over.</p>

<p>My constructor throws this error</p>

<pre><code>array.cpp:40:35: error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive]
</code></pre>

<p>When my array initializes I want it to free up all the spaces in the array for ints.</p>

<pre><code>Array::Array(int theSize){
size = theSize;
int *arrayPointer = new int; 
int index = 0;
while(theSize &gt; index){
  *(arrayPointer + index) = new int; //This is the trouble line.
  ++index;
 }
}
</code></pre>

<p>What am I doing wrong stackoverflow?</p>
