C: unsigned char * bytes array copying elements to other unsigned char * array
<p>I think that copying elements of array like this: </p>

<pre><code>unsigned char *new_bytes_array = malloc(sizeof(unsigned char)*length/2); 
for(int i=0, j=0; i&lt;length; i++) {
  if(i % 2 == 0) continue; 
  new_bytes_array[j] = old_bytes_array[i]; 
  j++;
</code></pre>

<p>}</p>

<p>is making copy but value not by reference, but I would like to make sure that this will be deep copy not just shallow copy of references or pointers. </p>

<p>I know that this is maybe easy and ridiculous qustion, but I cannot find similar on stack rather memcpy() all array, but I want to copy only some elements for example every second element, or copy 1-3 elements and skip 4th element, (if i%4 == 0 skip element). </p>