Friday, March 4, 2011

2.4 Declarations

  • All variables must be declared before use. (certain declarations can be made implicitly by context)
  • A declaration specifies a type and a list of one or more variables associated with the type
  • A variable may also be initialized in its declaration
  • An explicitly initialized automatic variable is initialized each time its function/block is entered
  • External and static variables are initialized to zero by default
  • Automatic variables with no explicit initializer has undefined (ie. garbage) value
  • The qualifier const can be applied to the declaration of any variable to specify that its value will not be changed (ie. const double e = 2.718)

No comments:

Post a Comment