title: Create a copy of the values inside of an array from the array itself in C
body: <p>I have an array with it the first <code>x_size*y_size</code> values filled, and now I need to duplicate them <code>DATA_JUMP</code> times in the same array in later memory.</p>
  
  <pre><code>for(int i=1; i &lt; DATA_JUMP; i++)
   for(int k = 0; k &lt; x_size*y_size; k++)
    orig_depth[k + i*x_size*y_size] = orig_depth[k];
  </code></pre>
  
  <p>This works like I want it to, however this may slow down on large datasets. I wonder if there is a trick to do this with a little pointer arithmetic. </p>