Changing int type to size_t.
As per http://stackoverflow.com/questions/3174850/type-for-array-index-in-c99
Fixing incorrect variable name.