If static keyword is applied to struct(or class),all of the members are static.
This isn't right.
It is not the structure that is declared static but the variable st. A variable declaration has the basic structure
[Storage Specifiers] [Type] [Variable Name];
This this case
Storage Specifiers
static
Type
struct
{
int a;
}
Variable Name
st
What the static keyword means is somewhat dependent on where this declaration appears in the rest of the code. Inside a function it indicates that the variable should not be put on the stack but in the data segment and is persistent while the function is not running. Outside a function it merely indicates that the variable is not accessable outside the file it is in.
So the static in your declaration means exactly the same as the static in this declaration
-
static int integer_variable;
-