All declarations have scope, which is the part of the program in which the declared name has the meaning it is declared to have. ‘File scope’ means from the declaration to the end of the file, and applies to types, functions and global objects.

‘Block scope’ means from the declaration to the end of the block statement in which it is declared. This always applies to local objects (including formal parameters), but can also apply to types, functions and global objects. All of the following declarations have block scope, and can be used by the trailing statements, but not by statements beyond the block:

{
  /* a local type */
  typedef int MyInteger;

  /* a local variable */
  MyInteger x;

  /* global variable */
  extern int y;

  /* function (extern is implicit) */
  int power(int base, int exponent);

  /* statements... */
}

Unlike Java, a local variable in an inner block may hide one in an outer block by having the same name:

{
  int x;

  {
    int x; /* hides the other */
  }

  /* first one visible again */
}