Hi all,
I am reading "C: A Reference Manual" 4th ed and I get lost for the
"extern". It says that global object without specifying the
storage-class specifier will have "extern" as the default storage-class
specifier. My (little) C experience tells me that an object with
"extern" is to let the linker knows that the object is referencing the
object defined in somewhere, and this "somewhere" object does not have
the storage-class specifier "extern". That is:
<------------ file A ------------>
int A;
...
A=10;
<------------ file B ------------>
extern int A;
if (A)
...
But if the default storage-class specifier is "extern", then
variable "int A" is, indeed, "extern int A". Then who is the definiting
occurence?
Please correct me if there is a mis-concept.
I am reading "C: A Reference Manual" 4th ed and I get lost for the
"extern". It says that global object without specifying the
storage-class specifier will have "extern" as the default storage-class
specifier. My (little) C experience tells me that an object with
"extern" is to let the linker knows that the object is referencing the
object defined in somewhere, and this "somewhere" object does not have
the storage-class specifier "extern". That is:
<------------ file A ------------>
int A;
...
A=10;
<------------ file B ------------>
extern int A;
if (A)
...
But if the default storage-class specifier is "extern", then
variable "int A" is, indeed, "extern int A". Then who is the definiting
occurence?
Please correct me if there is a mis-concept.
Comment