ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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

user-image
تم إضافة السؤال من قبل Afzali Jan Afridi , Android Application Dveloper , Tarmyz IT Solution pvt. (Munawla.com).
تاريخ النشر: 2015/04/28
Sajjad Navab
من قبل Sajjad Navab

 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
من قبل 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.

سعد رضا ٰ
من قبل سعد رضا ٰ , 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
من قبل 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.

المزيد من الأسئلة المماثلة