Arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Arrays

doesn't arr[5][5] contains 36 elements?

10th Jul 2017, 10:39 AM
Giorgi Gogelashvili
Giorgi Gogelashvili - avatar
3 Answers
+ 2
The indices do start at 0, but they end at size - 1. So, arr[5][5] has 5 rows numbered 0 to 4, where each row has 5 values also numbered 0 to 4. Thus, you get 5* 5 = 25 total values.
10th Jul 2017, 12:01 PM
Igor B
Igor B - avatar
+ 1
arr [5][5] only gives 25 elements
10th Jul 2017, 11:55 AM
Deddy Tandean
0
I thought it counted from 0 😂
10th Jul 2017, 10:45 AM
Giorgi Gogelashvili
Giorgi Gogelashvili - avatar