Copying 1-D array into 2 -D array
- by Digvijay Yadav
I have one two dimensional array and one single dimensional array.
The two dimensional array is of NxM size. And the one dimensional array is of size N x M means
it has N X M elements.
Now I want to copy all the elements of the one dimensional array into the 2-D array.
This is what I tried
for(i = 0; i < M; i += 1) {
for(j = 0; j < N; j += 1) {
arr2d[i][j] = arr2d[(i*j +j)];
}
}
But not working Any suggestions???