title: C++ Pointer Arrays
body: <p><strong>Code</strong></p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  
  void someFunc(double* pDoubleArray, int length)
  {
      double* pNewDoubleArray = new double[length];
  
      for(int i = 0; i &lt; length; i++)
      {
          pNewDoubleArray[i] = i * 3 + 2;
      }
  
      pDoubleArray = pNewDoubleArray;
  }
  int main()
  {
      double dbls[] = { 1, 2, 3, 4, 5 };
  
      int length = sizeof dbls / sizeof dbls[0];
  
      std::cout &lt;&lt; "Before..." &lt;&lt; std::endl;
  
      for(int i = 0; i &lt; length; i++)
      {
          std::cout &lt;&lt; dbls[i] &lt;&lt; ", ";
      }
  
      std::cout &lt;&lt; std::endl;
  
      someFunc(dbls, length);
  
      std::cout &lt;&lt; "After..." &lt;&lt; std::endl;
  
      for(int i = 0; i &lt; length; i++)
      {
          std::cout &lt;&lt; dbls[i] &lt;&lt; ", ";
      }
  
      std::cout &lt;&lt; std::endl;
  
      while(true){ }
  
      return 0;
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>Before...
  1, 2, 3, 4, 5,
  After...
  1, 2, 3, 4, 5,
  </code></pre>
  
  <p>Here's what I am trying to do:
  1. Create an array and fill it with some values
  2. Pass that array as a pointer to a function that will create a new array and reassign the one that was passed in to the newly created array
  3. Print out the changes</p>
  
  <p>I am not seeing any changes though, and I do not know why.</p>