The arr
array refers to this array:
[
[1, 2],
[3, 4],
[5, 6, 7]
]
When i
equals 1
, arr[i]
refers to the inner array [3, 4]
. You can trace it in the diagram. arr
points to this array with three blocks. From there the block with the index of 1
(this is i
) points to the array that contains the numbers 3
and 4
.
When j
also equals 1
, arr[i][j]
refers to the number 4
. In the diagram, the block with the index 1
in array [3, 4]
contains the number 4
.
So arr[i][j]
when i
and j
are both 1
is just the number 4. You multiply this 4
to the number in product
(the number 6
), so now you have 24
.
Related thread: