[変数]

◆変数の定義
 Delphiでは、var文を使い、「var 変数名:変数型」と宣言します。

◆変数型

・整数型
サイズ範囲対応する.NET型
Integer符号付き 32ビット-2147483648..2147483647Int32
Cardinal符号なし 32ビット0..4294967295UInt32
Shortint符号付き 8ビット-128..127SByte
Smallint符号付き 16ビット-32768..32767Int16
Longint符号付き 32ビット-2147483648..2147483647Int32
Int64符号付き 64ビット-2^63..2^63-1Int64
Byte符号なし 8ビット0..255Byte
Word符号なし 16ビット0..65535UInt16
Longword符号なし 32ビット0..4294967295UInt32

・実数型
サイズ範囲有効桁対応する.NET型
Real8バイト-5.0 x 10^324 ..1.7 x 10^30815-16Double
Single4バイト-1.5 x 10^45 ..3.4 x 10^387-8Single
Double8バイト-5.0 x 10^324 ..1.7 x 10^30815-16Double
Extended10バイト-3.6 x 10^4951 ..1.1 x 10^493210-20Double
Comp8バイト-2^63+1 .. 2^63-110-20-
Currency8バイト-922337203685477.5808..922337203685477.580710-20Decimal
Real486バイト-2.9 x 10^39 ..1.7 x 10^3811-12-

・文字型
サイズ範囲対応する.NET型
Char8ビット-2147483648..2147483647Int32
AnsiChar8ビット0..4294967295UInt32
WideChar16ビット-128..127SByte

・文字列型
サイズ範囲対応する.NET型
string---
AnsiString4バイト-2GB2^31文字char
WideString4バイト-2GB2^30文字char
ShortString2-256バイト255文字

・文字列ポインタ
ポインタの型内容
PCharNULLで終わるChar文字列を指すポインタ
PAnsiCharNULLで終わるPAnsiChar文字列を指すポインタ
PWideCharNULLで終わるPWideChar文字列を指すポインタ