Hacker News new | ask | show | jobs
by dllthomas 1391 days ago
But I think that still leaves open the question of "offset from what?"

If you move zero from the first element, you're still at the first element... but if you move zero from the fourth element you're still at the fourth element. If you move one from before the first element, you're at the first element.

I think you're more or less right, but I think we still need something to motivate the first element as the point of reference, and the machine focus is one way to do that.

1 comments

In some languages/environments, the array is literally the same as the pointer to the first element.

Other languages are more sophisticated (like humans are!) and can say that position 0 does not exist. An array of size 0 has no elements. An array of size 5 has elements 1at through 5th. An array of size N has 1st through Nth, inclusive.