Updated for-loop to C99 std.