What are the rules on declaring integers?

You should define any variable (not just the integer ones) with the minimum scope possible.

Some of the provided examples are not very good in this respect.