in reply to Implementing a cyclic array

Use the % operator.