Definition:
Data Types are diffrent kinds of information that may appear in the C/SIDE Environment.
Different data types having different values and each of them having diffrent way of representation.
Example:
If we have two data types "12" and "36" and add them, we will get different values according to different data types. ie, If they are numbers then the result would be 48 and on the other hand if we consider these are text then the result would be "1236" only.
Data Types can be mainly divided in to 4 types
- Simple Datatypes
- Numeric Data Types
- String Data Types
- Boolean, Date and Time
- Simple Datatypes: Simple data types are those types of data which have only one value and which cannot be broken up into other values of different types.
- Numeric Data ypes: Numeric Data Types are all forms of numbers or amounts.
TYPE | RANGE | SIZE | EXAMPLE | DEFAULT VALUE |
---|---|---|---|---|
Integer | From 2,147,483,647 to + 2,147,483,647 | 4 Bytes | 12 1000 -100 0 | 0 |
Decimal | From -1X10^63(1 followed by 63 zeros) to + 2,147,483,647 | 12 Bytes | 12.50 -2.0 0.008 | 0 |
Option | Red, Orange, yelow, Green, Blue, Indigo, Violet Where 0 is Red and 3 is Green | 0 | ||
Char | 0-255 | 1 Bytes | 'b' 'C' '3' '?' |
String Data Types:
TYPE | RANGE | SIZE | EXAMPLE |
---|---|---|---|
Text | From 0 to + 250 | add one to the length and round up to the nearest four. Thus and 8 char text takes up to 12 bytes (1+8 round up to the nearest 4) | "Hello" '127.50' |
Code All Letters are forced to upper case and all leading and trailing spaces are removed. | add 2 to the length and round up to the nearest 4. Thus an 11 character code takes up 16 bytes (2+11 round up to the nearesr 4) | 'HELLO' '127.50' |
- Boolean, Date and Time
TYPE | RANGE | SIZE | EXAMPLE |
---|---|---|---|
Boolean | 1 Byte in memory only | TRUE FALSE | |
Date | 1/1/0000 through 12/31/9999 | 4 Bytes | 0D (The undefined date, less than all other dates) 123197D (Dec 31 1997) |
Time | 00:00:00through23:59:59:999 | 4 Bytes | 1030000T (10:30am) 0T(The undefined time, less than all other times) |