The display indicates that I variables cannot be defined in for and must be defined outside, which is why?
Because the previous C standard of the C99 standard is not supported for temporary variables defined in the For loop.
The C99 standard supports such writing. However, there are some compilers that are not ready to support the C99 standard, or are compiled in C89 mode by default.
If you are using visual c++6.0, then there is no way, the goods have stopped updating, it is impossible to support C99.
If you are using a gcc compiler (v3.0 or more), the default is to compile by C89. Manual compilation with-std=c99 on the line can be compiled according to C99 Standard, the above to write no problem. Like what:
Gcc-std=c99 Tset.c-o Test
If you use the GCC compiler's codeblocks, you know how to make it default to automatically compile with the C99 standard:
Settings-Compiler and debugger ...
Open the Compile Debug Settings panel and add-std=c99 to the other options in the global compiler settings item.
Other Ides that use GCC should be able to set this.
But the proposal or according to C89 writing, many places written C99 standard will go wrong, who told them not to buy C99 account.
After modification:
Why is the for (int i=0;i<9;i++) error in the C language?