Changed type of loop variable to avoid warning of comparison between
signed and unsigned integer expressions.