Declare counter variable within the 'for' loops. (C99)
Initialize variables upon declaration.
Remove unneccary '!= 0' check.