c++ compilation error prompt [Error] name lookup of’i’ changed for ISO’for’ scoping

In VC 6, the scope of I is the function scope, and the variable I can be used outside of the for loop, that is:
for (int I = 0; i < n; + + I) {
//…
}
cout< < i< < endl;
can be passed by
and
for (int I = 0; i < n; + + I) {
//…
}
int i = 5;
compilation error.
In DEV C++, the scope of I is limited to the for loop, that is:
for (int I = 0; i < n; + + I) {
//…
}
int i = 5;
can be passed by
and
for (int I = 0; i < n; + + I) {
//…
}
cout< < i< < endl;
compilation error.
In VS.net, both pass, but if I is used outside of the for loop, warnings are given.

Read More: