Problems about array modification

Suppose i have a char 2d array and i would like to write a recursive function to modify the array in the following way.And the function base on the new array to modify according to the same process until i = 8.
i=1, array =
0
1
First, reflect the array
array =
0
1
1
0
Finally, append a 0 in the first half and append a 1 in the second half
i=2, array =
00
01
11
10
Here is my code and any opinion will be appropriated.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
int size = pow(2,i);
const int NEW_SIZE = pow(2,i+1);
char new_array[NEW_SIZE][BITSIZE+1];
for(int j=0; j<size; j++){
    for(int k =0; k<i; k++)
        new_array[j][k+1] = initial_array[j][k];
    new_array[j][0] = '0';
    }
for(int j=0; j<size; j++){
    for(int k =0; k<i; k++)
    	new_array[size+j][k+1] = initial_array[size-1-j][k+1];
    new_array[size+j][0] = '1';
    }
if (i != 8)
    binary_reflection(new_array, i+1);
Last edited on
Who can help me figure it out?
Topic archived. No new replies allowed.