If it's for a 1-based language, it's wrong because it compares with "<" and not "<=".
So, I guess that proves your point that it's error-prone. :)
In C, the idiomatic way is (as you surely know) "for(i = 0; i < n; ++i)".
If it's for a 1-based language, it's wrong because it compares with "<" and not "<=".
So, I guess that proves your point that it's error-prone. :)
In C, the idiomatic way is (as you surely know) "for(i = 0; i < n; ++i)".