DATA TYPES



1)  Types of Variables


There eight memory variable types in C--, they are byte, word, dword, char,
int, long, fixed32s and fixed32u.  The following table shows the size and
range of each of the variable types:

  

 

 

 NAME   | SIZE  |        VALUE RANGE                  |        VALUE RANGE

              |(bytes)|             (decimal)                            |           (hex)

 ----------------------------------------------------------------------------

  byte        |   1   |            0 to 255                                   0x00 to 0xFF

  word        |   2   |           0 to 65535                               0x0000 to 0xFFFF

  dword       |   4   |          0 to 4294967295   |                 0x00000000 to 0xFFFFFFFF

 fixed32u |       4   |          0 to 65535.999985                  0x0000.0000 to 0xFFFF.FFFF

  char        |   1   |            -128 to 127                              0x80 to 0x7F

  int         |   2   |              -32768 to 32767                      0x8000 to 0x7FFF

  long    |   4   |             -2147483648 to 2147483647     0x80000000 to 0x7FFFFFFF

 fixed32s |   4   |          -32768 to 32767.999985             0x8000.0000 to 0x7FFF.FFFF


NOTE1: 32 bit (4 byte) integer instructions are used to implement dword,
       long, fixed32s and fixed32u values, therefore support for these data
       types is limited to 80386 and higher CPU's.
NOTE2: fixed32s and fixed32u are not fully implemented, and will be available
       future versions of C--.

2)  Declaration of Global Variables

The syntax for declaring variables is as follows:

variable-type identifier;

Where variable-type is any one of char, byte, int, word, long or dword.
Several identifers may be declared of the same type as follows:

variable-type identifier1, identifier2, ... , identifierN;

One dimensional arrays may be declared as follows:

variable-type identifier[elements];

Where elements is a constant expression for the amount of entries of that
variable type to be in the array.

Some examples of global declarations:

byte i,j;       /* declare i and j to be of type byte */
word see[10]    /* declare see to be an array of 10 word's */
int  h,x[27]    /* declare h to be of type int and declare x to
                   be an array of 27 int's */




Post a Comment

0 Comments