2Darray in 1Darray and sum elements
Hello and congratulations for the forum!
My problem: we have a 2D array[i][j] nxn . We put serial the rows of the 2D array in one 1D array[t].Next we have a function with this prototype:
The int that the function returns is 1 or 0.
int myfunc(array[t] , n);
1(one) if the sum of each row and column(like as we have a 2D array) in 1D array is the same returns 1,otherwise returns 0;So i am very confused with the loops that i must do.Can anyone give me an idea?
My thougt, as example we have a 3X3 array:
[img=http://img17.imagevenue.com/loc1116/th_11174_array_122_1116lo.jpg](the numbers are random)
for the sum of the the rows in array[t] we must make 3 loops and for each loop i must calcuate the sum each t/n=3 elements (from 0-2, 3-5, 6-8 )
for the rows i must sum example the array + array[t/n] + array[2t/n]
Am i wrong? How can i do the loops?