how can we get an array whose index will be start from 1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can we get an array whose index will be start from 1

Whenever you make a variable of arry type by default index starts from 0 but what is do that index starts from 1 ex by deafault a[3] having index 0 1 2 but accourding to my ques a[3] index will be 1 2 3

27th Nov 2019, 3:15 AM
Siddhant Jain
Siddhant Jain - avatar
1 Answer
+ 2
All arrays are 0 indexed so what you are trying is not possible but you can always access the element at any index given that the index is between 0 to arraySize - 1.
27th Nov 2019, 3:21 AM
Avinesh
Avinesh - avatar