say I have a 1D array like int[] x = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}.
I would like to conver it into 2D where it looks like:
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
Currently, I have
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < Nb; j++)
s[i][j] = x[i + j];
}
However, that doesnt work. How would I do this?
Try