In the formal C terminology specifiers like extern
, static
, register
etc. are called storage-class specifiers, but the actual object properties these specifiers control are called storage duration and linkage.
In your question you seem to be mixing these two unrelated concepts: storage duration and linkage. It is actually linkage that describes external visibility of the object.
All variables defined in file scope have static storage duration (regardless of whether you used the keyword static
in the declaration). This simply means that they live forever, but it does not say anything about their external visibility. Meanwhile, variables defined with keyword static
have internal linkage, while variables defined without any keywords or with keyword extern
have external linkage.
In your example variable Road
has static storage duration and external linkage, which is why you can access it directly from other translation units. Variable Count
has static storage duration and internal linkage, which is why you can't access it directly from other translation units.
If you declare a variable without a storage class specifier (like Road
in your example), it will be treated as so called tentative definition and finally resolve (in your example) to a variable with static storage duration and external linkage. So, from that point of view it is right to say that the default (implied) storage class specifier for file scope variables is actually extern
, not static
.