lets say its something like array[4][4]
it should have 4 columns and 4 rows
If I want to access the particular location,
say the 2nd row and 1st column, is it suppose to be array[2][1] or array[1][2]?
lets say its something like array[4][4]
it should have 4 columns and 4 rows
If I want to access the particular location,
say the 2nd row and 1st column, is it suppose to be array[2][1] or array[1][2]?
Actually, indexes begin at 0 so 2nd row would be index 1 and 1st column would be index 0.
But the order can really work whichever way you like it. However, the way C lays out the memory for an array is that the right-most index increases first. So the column is usually the 2nd index and the row is the first index.
1 2 3 4 5
6 7 8 9 0
-- array[0][1] is 2.
-- array[1][[3] is 9.
Is that what you were looking for?
If you understand what you're doing, you're not learning anything.
The first number is the row and the second number is the columb. How everan array always starts from 0, so array [2][1] would point to the element in the third row and second columb. Hope this helps.
yes thank you very much