+ 1
Question says to store 5 integers but solution says int myarray[5].(check description)
an array starts counting from 0. i.e 0,1,2,3,4,5 which makes a total of six integers. please explain.
2 Antworten
+ 4
The number "5" in int myarray[5] means how many elements the array can store. You are thinking of it as an index value; but rather, it is the amount of elements the array can store. So really, the index values for that array would be 0, 1, 2, 3, 4 and that would be five elements.
0
Exactly