8
votes
3answers
2k views

Why are off by one errors so common and what can we do to prevent them?

It seems that off-by-one errors are one of the most (if not the most) common programming errors (see What are common mistakes in coding?, and conventional wisdom). What is the reason these are so ...