Type declarations


   Type declarations

When you declare a variable, you must state its type.

A variable's type defines the set of values it can have and the operations that can be performed on it. A type declaration specifies the identifier that denotes a type.

When an identifier occurs on the left side of a type declaration, it is a type identifier for the block in which the type declaration occurs.

A type identifier's scope does not include itself, with the exception of pointer types.

There are six major classes of types:

  1. Simple types define ordered sets of values.
     Ordinal types
      Integer types
      Boolean types
      Char type
      Enumerated types
      Subrange types
     Real types
  2. String types are a sequence of characters with a dynamic length
     attribute and a constant size attribute.
  3. Structured types hold more than one value.
     Array types
     Record types
     Object types
     Set types
     File types
  4. Pointer types define a set of values that point to dynamic variables of
     a specified type.
  5. Procedural types allow procedures and functions to be treated as
  6. Object types are structures with a fixed number of components.

Тэги: Type-declarations
| G+
Код для вставки: :: :: :: ::
Поделиться: // //