Hacker News new | past | comments | ask | show | jobs | submit login

Why is it zero indexed? Tradition. Why did that tradition start? The best explanation I can think of is because array access is a convenient short hand for pointer math:

array[i] translates perfectly into array_memory_start + i*element size. Thus the tradition was most likely born.




> was most likely born I take it you just posted this comment for fun and didn't RTFA? That was the whole point; the author answered the question of how the tradition was born, down to the person and year.


I did read it. And all he says is that C was zero based but doesn't say why that happened. Unless it was in the comment thread or one of the several second order articles which I'll freely admit I didn't read.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: