Is it bad to declare variables inside the main loop?

What AWOL said, plus...

First of all, write your programs so that they are clear and function correctly. If they are clear, they are more likely to function correctly also.

Then, IF AND ONLY IF you need more performance, you can worry about optimizations at this level.