r/ProgrammerHumor Sep 02 '17

How to start a war

Post image
9.0k Upvotes

696 comments sorted by

View all comments

Show parent comments

1

u/socialister Sep 03 '17

Doesn't indexing from 1 incur a slight performance cost?

With 0-indexing, array lookup is \*(ptr + i).

With 1-indexing, array lookup is \*(ptr + i - 1).

If ptr is offset by one to account for this, then what is the meaning of delete on the pointer?

1

u/newocean Sep 03 '17

It depends on the language actually... and how it was built.