Both must compile.
Both int i; and static int i; are preliminary definitions in C because they have no initializer and are not extern . You are allowed several preliminary declarations and no more than one unintentional definition for any object in translation units, if the definitions do not conflict with the type or relationship.
ISO / IEC 9899: 1999 6.9.2:
Declaring an identifier for an object with a file area without an initializer and without a storage class specifier or static storage class specifier is a preliminary definition. If the translation unit contains one or more preliminary definitions for the identifier, and the translation unit does not contain external definitions for this identifier, then the behavior is performed exactly as if the translation unit contained the declaration of the scope of this identifier, and the composite type as the end of the translation block, moreover initializer is 0.
Charles Bailey
source share