GCC version: GCC version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
The source file of the program written is 643b. C,
In this file, there is a statement: For (INT I = 0; I <11; I ++)
Run the compilation command: gcc-O 643b 643b. c
An error is reported:
643b. C: In function 'main ':
643b. C: 5: 2: Error: 'for' loop initial declarations are only allowed in c99 Mode
For (INT I = 0; I <11; I ++)
^
643b. C: 5: 2: Note: Use Option-STD = c99 or-STD = gnu99 to compile your code
You need to add the parameter-STD = c99 or-STD = gnu99 to the command line.
Gcc-O 643b 643b. C-STD = c99
Run the program:./643b
Expected result:
I am happy
Or:
Gcc-O 643b 643b. C-STD = gnu99
Run the program:./643b
Expected result:
I am happy
The cause of the error may be that the initialization in the for loop can only be performed in the standard c99 or gnu99.
Defines the type of I, so you need to add the parameter:-STD = c99 or-STD = gnu99
An error is reported during I variable initialization in the for loop.