PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] global variables
Date: Friday, 04 Sep 2020, 21:58:19


    > Message Posted By: Unknown
    >
    > Are we allowed to use them?

Yes, you may use global variables subject to the style
guidelines:

  Global Variables and Functions
   
   8) Global variables should be used sparingly and only with good reason.  In
      particular, they should never be used solely for the purpose of returning
      multiple values from a function.
   
   9) Global variables should have names that are descriptive enough to remind
      the reader of their meaning and distinctive enough (e.g., first letter
      capitalized or camelCased) to indicate that they are not local variables.
   
  10) Each global variable should be described in a comment.
   
  11) When a global variable or function is used in a .c file other than the
      one in which it is defined, it should be declared in a .h file that is
      #include'd in both source files.  When a global variable or function
      (other than main()) is only used within a single module, it should be
      declared static.

--Stan-
PREV INDEX NEXT