Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>extern external data storage class</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 extern                  External Data Storage Class

    When used with a variable, the extern class specifies that the object
    is defined elsewhere in the program as an external, possibly in the
    same source code file.  The extern keyword may be used both
    internally and externally to a function.  An external variable has
    permanent life and can be accessed from any file in which it was
    declared (using extern).  If the extern declaration is specified
    inside a function, the object's scope is limited to the block in
    which it is declared, and all subordinate blocks (if any).  The scope
    of an extern object declared outside a function is from the point of
    declaration through the end of the source code file.  The form of an
    extern declaration for a variable is:

             extern [type] identifier [[, identifier] ... ] ;

    When used with a function definition, the extern class causes that
    function's name to be made global; that is, it can be called from any
    function in the program.  This is the opposite of `static'.  The form
    when used with a function definition is:

             [extern] [type] function-name ([argument-list])

    The extern class can also be used with a function declaration,
    indicating that function is defined elsewhere, possibly in the same
    source code file.  The form when used with a function declaration is:

             [extern] [type] function-name ([argument-list]) ;

      Notes:    Variables with the extern class may not have explicit
                initializers, since they refer to variables that are
                defined elsewhere.

                Since by default all functions have class extern, the
                keyword is rarely used either in function definitions or
                declarations.

                If a function is called before it has been declared, it
                is assumed to have class extern and type int.

                If the type of an extern variable is omitted, int is
                assumed.

   -------------------------------- Example ---------------------------------

           extern int max, total;
           extern struct date today;
           extern int test();

           extern int testchar()
           {
                extern int i;
                extern double average();
                ...
           }




See Also: static

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson