15.8k views
5 votes
Which error type does the "off-by-one" error belong to?

A. syntax error
B. compile-time error
C. run-time error
D. infinite loop

User Icecrime
by
8.3k points

1 Answer

5 votes

Answer:

The answer is C. run-time error.

Step-by-step explanation:

The "off-by-one" error is a type of run-time error that occurs when a loop or an array index is either incremented or decremented by one more or one less than intended. This error can lead to unexpected program behavior, such as accessing memory that is out of bounds or skipping over elements in an array.

User UneXp
by
7.3k points