|
|
|
|
|
by lopmotr
2919 days ago
|
|
It's embarrassing but that's what I routinely do when declaring and indexing arrays. I imagine an array with 2 items (index 0 and index 1) and say "that's got length 2 and maximum index 1", so for my length 50 array, the maximum index will be 49. Similarly for intervals and 1-based arrays, etc. All of that talking to myself over and over again! I almost never get off-by-1 errors though. It's a good reason to use iterators instead of for loops. |
|
"well, if it spanned to row 19, there would be two elements, so N elements end at row 17+N, so 33-17 is 16, so there are 16 elements."
That's painstaking and I should fix it, lol.