^ pointer dereference pointer base type of pointer P^

解决方案 »

  1.   

    指针类型啊!
    To see how pointers work, look at the following example.1    var2      X, Y: Integer;   // X and Y are Integer variables
    3      P: ^Integer;     // P points to an Integer
    4    begin
    5      X := 17;         // assign a value to X
    6      P := @X;         // assign the address of X to P
    7      Y := P^;         // dereference P; assign the result to Y
    8    end;Line 2 declares X and Y as variables of type Integer. Line 3 declares P as a pointer to an Integer value; this means that P can point to the location of X or Y. Line 5 assigns a value to X, and line 6 assigns the address of X (denoted by @X) to P. Finally, line 7 retrieves the value at the location pointed to by P (denoted by ^P) and assigns it to Y. After this code executes, X and Y have the same value, namely 17.^typeName梚t denotes a type that represents pointers to variables of type typeName. When it appears after a pointer variable?pointer^梚t dereferences the pointer; that is, it returns the value stored at the memory address held by the pointer.