Arrays start from 0 then 1,2... But why are indexes positive, why are indexes not negative?
closed as off-topic by Gypsy Spellweaver, ncmathsadist, ItamarG3, Ben I.♦ Oct 28 '18 at 18:20
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not appear to be about Computer Science education, within the scope defined in the help center." – Gypsy Spellweaver, ncmathsadist, ItamarG3, Ben I.
You are starting with a base memory address and you are adding an offset having the size of one array element for each following element. This makes address calculation very easy (base address + n * size of data structure).
Negative indexes are not allowed because you would refer to the memory address in front of your base address, which means you might destroy other variables content.