C - Declaration and Definition

From EdWiki

Declaration and Definition

  • Definition refers to the place where the variable is created or assigned storage.
  • Declaration refers to places where the nature of the variable is stated but no storage is allocated.
  • In other words, a declaration announces the properties of a variable(primarily its type); a definition also causes storage to be set aside.
  • There must be only one definition of an external variable among all the files that make up the program.
  • There may also be extern declarations in the file containing the definition.