in a two dimensional matrix in c how开发者_如何学Go do i know when the element is still on the current line and not on the second line of a matrix in a 1 dimensional array. aka how do i show that d is on the top line and d is one the next line in these two matrixs?
a b c
d e for
a b c d
e f g h
You can represent it in a 1D array, but you have to take care of the logic, which index belongs to which row and column.
e.g.: for a 4×4 matrix - index 0 to 3 would be on the first row. 4-7 on the second, etc.
精彩评论