You should always reduce the scope of the variables as much as possible. This will improve the maintainability of your code, and reduce the chance of bugs.
// bad
int i, j, k;
k = 0;
for (i = 0; i < X, ++i)
{
j = foo(i);
k += j;
}
bar(k);
... vs ...
// better
int k=0; // needs scope outside loop
for (int i = 0; i < X, ++i)
{
int j = foo(i);
k += j;
}
bar(k);