Why is the maximum index position of an array example:(NAME[6]) is 5 even when the initial index position is 0? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why is the maximum index position of an array example:(NAME[6]) is 5 even when the initial index position is 0?

28th Apr 2016, 2:05 PM
Sammy Das
Sammy Das - avatar
3 ответов
+ 7
because you start counting from 0-1-2-3-4-5 its 6 numbers
13th May 2016, 2:05 PM
Thoriso Seitatolo
Thoriso Seitatolo - avatar
0
0 =1, 1=2 and so forth.
26th Jun 2016, 10:12 PM
jazper6
0
arr[size] Here size represents total number of elements an arr can hold. Ex. size = 4 arr can hold 4 element, those 4 elements are indexed from 0-3, 0,1,2,3 And thats how it works
8th Oct 2016, 1:54 AM
Danish Khan
Danish Khan - avatar