What is an off-by-one error and how do I fix it?
An off-by-one error is for example when you intend to perform a loop n times and write something like: for (int i = 1; i < n; ++i) { … } or: for (int i = 0; i <= n; ++i) { … } In the first case the loop will be executed (n – … Read more