When using Keil to write programs, inadvertently found a particularly simple and easy to ignore the problem, compile the following error:
Error: #77-D: This declaration has no storage class or type specifier
According to the error point, found that the corresponding program line is very simple, (the real program is to define the structure, and then the structure of the assignment), where the equivalent simplification, the program is as follows:
//////////////
int A;
A = 1;
/////////////
Then found the beginning of the article error, after debugging to know: "The assignment of variables generally can not be placed outside the function , only in the definition of global variables when the initialization is allowed." ”
So if you have to define variables outside of a function, either do not assign a value definition (defined within a function), or immediately define it after the declaration, for this example, you can modify the following:
int a=1, so there is no error.