C++ basic array assignment is not working
<p>So I have a function </p>

<pre><code>f(int D[],int A[],int len){ 
   for(int k = 0; k &lt; len; k++)
      D[k] = A[k];
</code></pre>

<p>and if I output <code>D</code> the numbers are all wrong. The function <code>f</code> is called with <code>D</code> initialised as <code>int* D = new int[100000];</code> in the <code>main</code> function and <code>A</code> is all good because I output it in the function and it looks ok. So... can't understand where the problem is... I also tried <code>memcpy(D+k,A+k,sizeof(int));</code> and it doesn't work.</p>
