Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

Why an array start from index 0 in java but in some programming languages it starts from 1?

user-image
Question ajoutée par Afzali Jan Afridi , Android Application Dveloper , Tarmyz IT Solution pvt. (Munawla.com).
Date de publication: 2015/04/28

 Def:- Array is ahomogenios collection values

Array always Starts form0 to N numbers 

If you take in any prgraming Langauge Likes of C,C++,Java Array will Start from0 onward 

-----------------------------------------------------------------------------

Muhammad Iqbal
par Muhammad Iqbal , Java Engineer , Celerant Technology

because the creators of the language decided it that way, supposedly to make the transition easier for C developers, but, the complete correct answer is: because it was designed that way.

سعد رضا ٰ
par سعد رضا ٰ , Software Engnieering , None

:look here to a strong  argument than Edsger W. Dijkstra's article

"Why numbering should start at zero"

and this answer 

http://stackoverflow.com/a/3484890

Mohamed Alesh
par Mohamed Alesh , Independent Contractor / Consultant , Upwork (Engineering Team - APIs)

This is probably a design decision, and since java syntax belongs to C and C++ family I think it makes sense to have indexes start with0. During my experience and if I remember correctly, the only thing that I have seen uses1 was the XSLT, there are others sure but that was the one I experienced in my jobs. I hope this answers your question.

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?