Originally posted by *
If you can do this, fine, but me personally I would be leary of it. I think scattering variables loosely in code is a bad idea-- it makes their declaration hard to find in any sizeable work (say 300K of sourcecode over 40+ files).
True! But in this case, we're talking about loop-variables.
I usually put all my "normal" declarations in the beginning of a block, or at well thought-out places.

In case of multiple for loops following each other, I declare a variables outside the for-loop so the loop can share the storage.
Code:
int i;

for(i=0; i<5; i++) cout << i;
for(i=3; i>1; i--) cout << i;
for(i=-3; i<=0; i++) cout << i;
But most of the time I put it inside. As far as I know, neither of the ways are right nor wrong. Depends on the compiler I suppose...