c - Copy i-value from array triple time -


i have array[768] have 256 (from 0 255) samples in array. want copy each value 0 255 , fill array better, mean:

[1][2][3]  - >  [1][1][1][2][2][2][3][3][3]  

how can that? there library function can this?

i don't recall known library function capable of doing this.

if want in-place, i'd right left (i.e. tail head), think way in-place:

int i, j; (i = 255, j = 767; > 0; i--) {     (int k = 0; k < 3; k++) {         array[j--] = array[i];     } } 

if don't need in-place, suffice:

for (int = 0, j = 0; < 256; i++) {     (int k = 0; k < 3; k++)         new_array[j++] = array[i]; } 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -