+ 1

Isn't "int a[5];" supposed to hold six values instead of 5?

Array lesson question

24th May 2017, 3:02 PM
Juan Carlos Soriano
Juan Carlos Soriano - avatar
3 odpowiedzi
+ 3
no no a[5] means it holds 5 values 0,1,2,3,4 are the address of the values i also got confused on that, so i thought i may clear your doubt too
24th May 2017, 3:25 PM
VanSHOE
VanSHOE - avatar
+ 1
5 is the length of the array (how many elements). Can't forget to include the 0'th index towards how many elements there are!
24th May 2017, 6:21 PM
Rrestoring faith
Rrestoring faith - avatar
0
oh yeah. thanks for clearing that one up
24th May 2017, 11:28 PM
Juan Carlos Soriano
Juan Carlos Soriano - avatar