twitter
    Find out what I'm doing, Follow Me :)

Additional Data Types

Loading and editing mortypes.c will illustrate how some additional data types can be used.

/* The purpose of the file is to introduce additional data types */


main( )
{
int a,b,c; /* -32768 to 32767 with no decimal point */
char x,y,z; /* 0 to 255 with no decimal point */
float num,toy,thing; /* 10E-38 to 10E+38 with decimal point */
a = b = c = -27;
x = y = z = ’A’;
num = toy = thing = 3.6792;
a = y; /* a is now 65 (character A) */
x = b; /* x will now be a funny number */
num = b; /* num will now be -27.00 */
a = toy; /* a will now be 3 */
}



Once again we have defined a few integer type variables which you should be fairly familiar with by now, but we have added two new types, the "char", and the "float". The "char" type of data is nearly the same as the integer except that it can only be assigned values between zero and 255, since it is stored in only one byte of memory. The "char" type of data is usually used for ASCII data, more commonly known as text. The text you are reading was originally written on a computer with a word processor that stored the words in the computer
one character per byte. In contrast, the integer data type is stored in two bytes of computer memory on most 8 bit and MS-DOS based microcomputers. The Applix 1616 uses a 68000 chip with true 32 bit registers, so integers are 32 bits. This means the range of an integer is not ±32767, but ±2147483648, or over two billion! On the Applix, a short int may be more appropriate in some places.