loop only runs once

Using sizeof (tile) will surely return the number of bytes in tile and since it is an integer array twice the value you want.

Paul