Delphi learning notes (1) -Object Pascal language data type

xiaoxiao2021-03-06  40

I have learned more than ten days of Delphi, I feel that this is easy to apply. Summarize the most basic knowledge here.

I. Data type: (1) Basic data type: a, integer type: (General type <32 digits>: integer- Symbol; cardinal- unsigned) specific: Sign: Shortint <8>, Smallint <16 >, Longint <32-bit> No Symbol: Byte <8-bit>, Word <16-bit>, LongiWord <32-bit> B, Character Type: (General Type <8>: Char - with Ansichar) Specific: Ansichar < 8-bit>: Mainly stores ANSI character widechar <16-bit>: Mainly store Unicode Character C, Boolean: (General Type <8>: Boolean- with ByteBool) Specific: Bytebool <8>, WordBool <16> LongBool <32-bit> Different Boolean types are mainly used for other programming languages ​​and different Windows systems. d, Enumeration Type: Definition: TYPE Enumeration Type Identifier = (Key1 [= VAL1], ...., Keyn [= VALN]): N <= 255 If you specify a value for some Key, no specified The value of the key is the previous key value plus 1; if all the defaults are not specified, the key1 value is 0, and 1 will be added one by one.

e, subjuntet type: Definition: TYPE sub-boundary type identifier = lower bound. . The lower bound is as: Type Subint = 1. . 3 0; represents an integer type subchar = 'A' of 1 to 30. . 'z'; indicates characters

※ Note: 1, the above four types are called ordered types, that is, in addition to the first number, there is a first number of lines, in addition to the last number, there is a successor number. it's here

(In the computer), the integer is limited. The number of ordered types has a serial number called the order. The number of integers is itself, other types of first

The number of numbers is 0 and increment sequentially. 2, on the sub-boundary type, the lower bound must have the same ordered type, and the upper order is greater than the lower sequence. f, floating point type: (General type <8 bytes>: real- with double equivalents) specific: double <8 bytes>, Real48 <6 bytes> Single <4 bytes>, Extended <10 bytes>, CoMP <8 bytes>, Currency <8 bytes>

g, String Type: (General Type: String- and ANSISTRING) Specific: ShortString: Up to 255 characters, the first one stores the character, not the NULL end ANSISTRING: Store the ANSI character, with NULL end WideString: Store unicode characters, ending h, time, date type: tdatetime - actually said that the floating point type

(2) Complex data type: a, pointer type: definition: TYPE pointer type identifier = ^ Basic type After freeMem () release memory allocation memory, you can use it as a basic type: pointer type identifier ^

It actually uses the pointer: VAR variable identifier: ^ basic type; after the variable distribution can be used as a normal variable.

b, record type: Definition: TYPE Record Type Identifier = Record Field 1: Type; . . Field N: Type; END;

C, Collection Type: Definition: Type Collection Type Identifier = Subsequiry or sub-boundary type of SET OF Basic Type; (<= 255 elements)

d, variant (general) type: Variant;

(3) Array type: a, one-dimensional array: definition: TYPE array identifier = array [subscript limit. . The upper limit of the subscript is the basic type;

b, multiple arrays: definition: Type array identifier = array [lower limit 1. . Limit 1 ,. . . , Lower N. . Limit N] OF Basic Type;

c, dynamic array (variable): VAR identifier: Array Of basic type; setLength (identifier, number); // Assign space identifier: = nil; // Release

转载请注明原文地址:https://www.9cbs.com/read-63008.html

New Post(0)