Thursday, June 9, 2011

6.1 Basics of Structures

  • Structure example:








  • An optional name called a structure tag may follow the word struct. (ie point)
  • The variables named in a structure are called members
  • A struct declaration defines a type
  • A struct declaration that is not followed by a list of variables reserves no storage, it merely describes a template or the shape of a structure.
  • If the declaration is tagged, however, the tag can be used later in definitions of instances of the structure
  • ie: struct point pt; defines a variable pt which is a structure of type struct point 
  • A member of a particular structure is referred to in an expression by a construction of the form: structure-name.member (ie. point.x )
  • Structures can be nested:


No comments:

Post a Comment