Common Data Types in Free Pascal¶
Here is a list of common data types in Free Pascal, along with a simple example.
See the official docs for more info; Types.
Summary Table¶
Type | Data Type | Range / Size |
---|---|---|
Integer | Byte |
0 .. 255 |
Integer | ShortInt |
-128 .. 127 |
Integer | SmallInt |
-32,768 .. 32,767 |
Integer | Integer |
-2,147,483,648 .. 2,147,483,647 |
Integer | LongInt |
Same as Integer |
Integer | Int64 |
-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807 |
Integer | Word |
0 .. 65,535 |
Integer | Cardinal |
0 .. 4,294,967,295 |
Integer | QWord |
0 .. 18,446,744,073,709,551,615 |
Boolean | Boolean |
True or False |
Character | Char |
ASCII characters |
String | String |
Default length 255 characters |
Floating-Point | Single |
±1.5 x 10^−45 .. ±3.4 x 10^38 |
Floating-Point | Real |
Similar to Single |
Floating-Point | Double |
±5.0 x 10^−324 .. ±1.7 x 10^308 |
Floating-Point | Extended |
More precise than Double (varies by implementation) |
Enumerated | Enum |
User-defined values |
Subrange | Subrange |
Defined range |
Record | Record |
User-defined complex type |
Advanced Record | Adv Record |
Records with methods |
Array | Static Array |
Fixed size |
Array | Dynamic Array |
Variable size |
Pointer | Pointer |
Memory address of a type |
Integer Types¶
Byte¶
- Range: 0 .. 255
- Example:
ShortInt¶
- Range: -128 .. 127
- Example:
SmallInt¶
- Range: -32,768 .. 32,767
- Example:
Integer¶
- Range: -2,147,483,648 .. 2,147,483,647
- Example:
LongInt¶
- Range: Same as
Integer
- Example:
Int64¶
- Range: -9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807
- Example:
Word¶
- Range: 0 .. 65,535
- Example:
Cardinal¶
- Range: 0 .. 4,294,967,295
- Example:
QWord¶
- Range: 0 .. 18,446,744,073,709,551,615
- Example:
Boolean¶
- Values:
True
orFalse
- Example:
Char (Character)¶
- Range: 'A' .. 'Z', 'a' .. 'z', and other ASCII characters
- Example:
String¶
- Length: Default length is 255 characters
- Example:
Floating-Point Types¶
Single¶
- Range: Approximately ±1.5 x 10^−45 .. ±3.4 x 10^38
- Example:
Real¶
- Range: Varies by implementation, usually similar to
Single
- Example:
Double¶
- Range: Approximately ±5.0 x 10^−324 .. ±1.7 x 10^308
- Example:
Extended¶
- Range: Varies by implementation, generally more precise than
Double
- Example:
Enumerated Types¶
- Example:
Subrange Types¶
- Example:
Record Types¶
- Example:
Advanced Records (with methods)¶
- Example:
Arrays¶
Static Array¶
- Example:
Dynamic Array¶
- Example:
Pointers¶
- Example: