> Online tutorial : scope
Showing posts with label scope. Show all posts
Showing posts with label scope. Show all posts


Scope
Both structure types and structure variables obey the rules of scope: that is to say, a structure type declaration can be local or global, depending upon where the declaration is made. Similarly if a structure type variable is declared locally it is only valid inside the block parentheses in which it was defined.
main ()

{ struct ONE

    {
    int a;
    float b;
    };

  struct ONE x;

}

function ()

{ struct ONE x;        /* This line is illegal, since ONE */
                        /* is a local type definition      */
                        /* Defined only in main()          */
}