Delphi Learning Notes (1) Find Algorithm

xiaoxiao2021-03-06  18

Delphi Find Algorithm

Sequence find an array

TYPE // If the two is equal to 0 If the first is less than the second return negative number Otherwise, the positive Tcomparefunc = function (Data1, Data2: Pointer): Integer; Function Comparelongint (Data1, Data2: Pointer): Integer; var l1 : Lingint Absolute Data1; L2: Lingint Absolute Data2; Begin IF L1 = L2 THEN Result: = 0; Else IF L1

1 Object Pascal specifies that the loop is ended normally, the value of the loop counter is undefined. In contrast, if it is too early, it is defined.

2 Use alist.list ^ [i] more efficient than List [i], because List [i] is actually calling a function TList.get, which checks if i's value is out of range, otherwise throwing an exception.

3 Absolute's role creates two addresses of the same variable.

writing now. . . .

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

New Post(0)