mardi 29 novembre 2016

How to determine if an array index is even?

I am working on an assignment in which I must fill a two dimensional array row by row. If the row's index value is even (0, 2, 4, etc..) the row must fill from right to left. If the row's index value is uneven (1, 3, 5, etc...), then it must fill from left to right. What condition should I put in my if statement in order for the filling of rows to alternate in this way?

Thanks!

Aucun commentaire:

Enregistrer un commentaire