What is default storage class for global variables?

The default storage duration is static, but default linkage is external. You’re not the only one to find it a bit confusing. The C Book (always a good reference) says:

“You’ll probably find the interactions
between these various elements to be
both complex and confusing: that’s
because they are!”

The section with that quote, Declarations, Definitions and Accessibility, has a helpful table (8.1). The last row describes the case you’re interested in. As it notes, data objects with no storage class specifier have external linkage and static duration.

Leave a Comment