0
When declaring myArray[5] it's creates elements from [0] to [4] why not from [0] to [5]?
and I get ... that is one more element :) but that's not the case
8 odpowiedzi
+ 2
with the declaration myArray [5] you say, you want 5 placeholders in your Array.
Because Arrays are zero-indexed the first placeholder has the index 0. So it's start with 0 and thats xour first index. Because you declared it with an index of 5 you get 4 more. So 1 is the second index, 2 the third, 3 the fourth and 4 is the last index you get
+ 1
Because it starts from 0, not from 1 (i.e. 0,1,2,3,4 it is five elements)
+ 1
because you declare one array whit 5 elements
1) myArray[0]
2) myArray[1]
3) myArray[2]
4) myArray[3]
5) myArray[4]
+ 1
Simple Answer: C# uses ZERO-Based Indexing i.e., Arrays, Collections, etc First Element Is at 0th Location.
Thanks
0
when you instantiate an array, you declare it's size.
but when you give them value, their index start from 0.
0
C# it's a zero-indexed programing lenguage. that means 0 it's the 1st value.
0
In declaring an array, you list the number of elements. In calling it, you call an element from its index position, and indexes start from 0 as c# is a zero-indexed language.
0
So that means C# uses 0-based indexing but not 0-based declarations?