0

Why the size of int a =[5] is 5 instead 6 , isn't the first term is 0?

22nd Apr 2016, 2:07 PM
Zhi Hao
5 Respuestas
+ 5
The last element of an array with size [5] has the index 4.
12th May 2016, 12:53 PM
James Flanders
+ 1
The size of the array is 5 and according to formula "index=array size-1" so Index is 4
11th Jun 2016, 6:54 PM
Prateek panda
Prateek panda - avatar
+ 1
The index is like this 0,1,2,3,4 That means size is 5 not 6
13th Jun 2016, 2:26 PM
Utpal Kumar
Utpal Kumar - avatar
0
When sending or retrieving the length of an array, you're dealing in a one-based system. Whereas locating an element at a specified index in an array is zero-based. Thus, we can deduce that `int a[5];` is dealing with length, which is a one-based system.
11th Jun 2016, 11:25 AM
Lucius Latham
Lucius Latham - avatar
0
the number , which is put between the brackets , is the count of the array elements
11th Jun 2016, 10:49 PM
ahmed osama
ahmed osama - avatar