It does not change the meaning. extern
only makes sense when you declare a variable. Defining a variable with extern
is the same because all global variables that are not marked static
are symbols visible to the linker by default.
Note that if you didn't want to initialise the variable, that is, not having the part = 10
, the compiler will assume that extern int a
is always a declaration and not a definition. In the same sense, having int a
globally is always a definition and not just a declaration.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…