0
Please help out. I want matrix B and G to outpit their values correctly.
2 ответов
+ 2
Do NOT use 3 for-loops!!! Simply use a loop over x*y*z, then calculate your indices:
bound = x*y*z
for (index = 0, index < bound, index++)
{
idx = index % x
idy = (index / x) % y
idz = (index / (x*y)) % z
matrix[idx, idy, idz] = ....
}
That's much more maintainable, readable and testable.
0
Thanks