6.4 Local variables

  --------------------

 

      Local variables are variables whose scope of action is a single

  function. Local variables can be declared (unlike in recent versions of C)

  between the name of the function and the first left brace (curly bracket).

  For example:

 

  void PROC ()

  int i;  // a local variable of type 'int' and name 'i' is declared

  {

      for ( i=0; i<10; i++ ) WRITE(1);

  }

 

      The memory for local variables is reserved on the stack.

 

      The options of the function are also on the stack and should therefore

  be used as local variables.

 

      Local variables can be initialized at declaration, with some

  restrictions. Arrays and multivariate structures cannot be initialized, i.

  e., when initializing local variables you cannot use calculations located

  in braces, or the operators FROM or EXTRACT.

 

      A local variable can have the same name as a global variable or a

  function. If this happens the global variable or the function is out of

  scope (that means has become inaccessable).

 

      Local variables can also be declared at the beginning of a function

  block, but only before the body of the program.  For example:

 

  void proc(){

  int locproc;  // declaration of a local function

    locproc=0;  // now comes the body of the function

  int locproc;  // this declaration of a variable will cause the compiler to issue an

// error message since the body of the function has also started

  }