Comment by tremon

4 months ago

But computers are not actually counting array elements, it's more accurate to compare array indexing with distance measurement. The pointer (memory address) puts you at the start of the array, so the first element is right there under your feet (i.e. index 0). The other elements are found by measuring how far away from the start they are:

  element_position = start + index*element_size

> But computers are not actually counting array elements

Sure. But from most general to least general, it goes:

Counting on fingers >>>> Math Equations >> Computer algorithms

The more general ones influence the less general ones because that's where most people start.