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:
- C++ compiler prompt “undefined reference to…”[How to Fix]
- C / C + + rounding function ceil(), floor ()
- Solutions to error c2143: syntax error: missing ‘;’ before ‘type’ in C + + program compilation
- C++:error C2228: left of ‘.str’ must have class/struct/union
- Error C2664 in C + + compilation: cannot convert parameter 2 from “const char [5]” to “lpctstr” solution.
- C code compilation_ Error: expected expression before ‘Int’
- The usage and difference of atoi() and stoi() functions in C + +
- Differences between length() size() and C strlen() of C + + string member functions
- C++ error: jump to case label crosses initialization
- C / C + + rounding function: round function
- The use of C + + template function and lambda expression
- Python2 PicklingError: Can‘t pickle <type ‘instancemethod‘>: attribute lookup __builtin__.instanceme
- Solution to ch32f103c8 burning prompt internal command error
- Register C# DLL prompt: it is not a valid .NET assembly
- Quartus ii 13.1 compilation does not pass: Error (119013): Current license file does not support the EP4CE10F17C8 device
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- Zend studio HTML error prompt close, PHP “error prompt” open and close the correct way
- Install python’s C extension compilation environment under windows (solve “error: command’cl.exe’ failed: No such file or directory”)
- [Solved] Logon failed, use ctrl+c to cancel basic credential prompt. unable to access
- error C2065: ‘cout’ : undeclared identifier