Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> type type declaration examples</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 TYPE                     Type Declaration Examples



 Declared Scalars:

  TYPE
    Day   = (Mon,Tue,Wed,Thu,Fri,Sat,Sun) ;
    Suit  = (Club,Diamond,Heart,Spade) ;
    Month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec) ;




 String Type:

  TYPE
    Name  = String[14] ;
    Scrn  = String[80] ;


 Array Type:

  TYPE
    Players = (1,2,3,4) ;
    Legal   = (1..200)  ;
    Bid     = Array[Players] of Bid ;


 Record Type:

  TYPE
    Days    = (1..31) ;
    Months  = (1..12) ;
    Years   = (1900..1999) ;
    Date    = Record
              Day   : Days   ;
              Month : Months ;
              Year  : Years  ;
              End ;

 Set Type:

  TYPE
    Days    = set of 1..31    ;
    WorkWk  = set of Mon..Fri ;
    Letters = set of 'A'..'Z' ;




 File Type:

  TYPE
    ProductName = String[80] ;
    FileName    = String[63] ;
  VAR
    Products    = File Of ProductName ;
    FileVar     = File Of FileName ;


 Array Constant:

  TYPE
    Status  = (Active,Passive,Waiting) ;




 Pointer Type:

  TYPE
    Dummy       = ^Integer         ;
    HeapPtr     = ^HeapRecord      ;
    HeapRecord  = Record
                  Name : String[80] ;
                  Job  : String[80] ;
                  Next : HeapPtr    ;
                  End ;
  VAR
    FirstRec, LastRec, NewRec : HeapPtr ;

See Also: Const Label Var

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson