We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How extern can be used?
In which file the variable without extern to be declared?
Or there is no such restrictions?
"Extern is used to access global variables/functions that have been declared in another module/file."
Actually, the global variables/functions must be defined in another module/file - extern provides just a declaration.
The definition is what actually creates the "object"; ie, allocates memory or generates code. Every "object" must have exactly one definition.
A declaration simply provides information that an "object" is defined elsewhere. An "object" may have many declarations.