2 ms·
> "what is the index of the last item?" 5 Usually, the more interesting question is: What is the index of the next item (when extending the array)? Which is 5
by tromp 4y ago
> "what is the index of the last item?" 5
Usually, the more interesting question is:
What is the index of the next item (when extending the array)?
Which is 5 in 0-based indexing.
- shoemakersteve 4y agoIs it? If you're doing low-level stuff maybe, but I really haven't done much of that so I'm not even sure I know what you mean by "extending" an array (presumably has something to do with allocating contiguous memory?) and I can't actually think of any situation off the top of my head where I would ever need "the last index + 1" what with array methods existing and all.