Actions

EmSys

C - External variables2

From EdWiki

Revision as of 09:30, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

External variables ...

  • If the program is in several source files, and a global variable is defined in file1.c and used in file2.c and file3.c, then extern declarations are needed in file2.c and file3.c to connect the occurrences of the variable.
  • The ANSI C standard calls this as external linkage.
  • In C, all functions are global and provide external linkage by default.