title: passing array on the heap and on the stack to function
body: <p>I have a simple c++ question concerning passing an array to a function foo(). Assume I have two arrays A and B:</p>
  
  <pre><code>double* A=new double[3];
  </code></pre>
  
  <p>and</p>
  
  <pre><code>double B[3];
  </code></pre>
  
  <p>When I pass both to the function</p>
  
  <pre><code>foo(double* A; double *B)
  </code></pre>
  
  <p>which is intended to manipulates both arrays. However by executing</p>
  
  <pre><code>foo(A,B)
  </code></pre>
  
  <p>foo is acting on a copy of A and only the changes to B remain when leaving foo(). 
  This is not the case if foo is defined as</p>
  
  <pre><code>foo(double* &amp;A; double *B).
  </code></pre>
  
  <p>My question: Why is a copy of a created although I pass the address of A like double* A (as in the case of B) in the first example of foo()?</p>