Initialise for loop counter before the loop

That's why I was setting std=c11!  Rather than do that, I'll just
initialise i at the start of the function so it's a bit more portable.