You're asking the compiler to give you data from row i and column j.
It needs to skip over rows 0...i-1. How many int
s are in each row, in order to do that? Hmm... you need to tell it (2 in your example).
Once on the correct row, it can count j
ints further to find the data you want.
Remember in RAM, the array isn't organized two-dimensionally. It's just a long long line of int
s. To reach the section of the line holding row i
, it has to skip over many in that line - and it needs to be able to compute how many.
One could imagine a queue of people waiting to fill a cinema (each row of seats in this cinema has the same number of seats). The people will fill row 1, then row 2, then row 3, ... You're asked to find, in the queue, the first person who will sit in row 3, to give them free popcorn. How many people will you count past? You'll definitely need to know how many people in each row, won't you? And yet it's irrelevant how many rows the cinema has, you don't need that information at all!
(You don't have to specify how many in the other element, because C arrays aren't bound like that, they have no upper bound; the compiler has enough info here to access row 0 or row 1,000,000, and will happily attempt either for you. It'll be up to you to pass in a valid pointer referring to that many rows.)