title: Converting malloc to new
body: <p>I am compiling using g++.  This is valid but I want to convert to the C++ operators new() and delete() because this is considered best practice.</p>
  
  <pre><code>  int *scratch = (int *)malloc(size * sizeof(int));
    free(scratch);
  </code></pre>
  
  <p>What is the equivalent using new and delete?  This is my guess.</p>
  
  <pre><code> int **scratch = new int*[size];
   delete[] scratch;
  </code></pre>
  
  <p>This is for an array of pointers.</p>
  
  <p>The double star is a reference.  It is a pointer to a pointer.</p>