What does the symbol "^" in Delphi 7?

    3 answers 3

    Pointers in the Pascal language. The first few links from the service of Sergey Brin:

      Oh, a long time ago I did not take Pascal into the hands :). I will try to add in a nutshell syntax:

      The symbol ^ ( "hat" ) in Pascal has two different meanings:

      In the declaration block, a cap in front of the type identifier declares a typed pointer:

       type P1 = ^T; { или } var P2: ^T; 

      where T is the data type identifier, P1 is the pointer type for type T , P2 is the pointer variable for type T

      In the implementation block, the ^ character after the variable identifier is the dereference operator, i.e., it means that it is not the value of the pointer itself that participates in the expression, but the value of its parent type.

       var X2: ^Real; { X - указатель на действительное число } begin X^ := Pi; X^ := X^ / 2; { присвоит π/2 по указателю X } end; 
      • It did not work out in a nutshell, please criticize. - Al Leween

      Google does not work.

      Briefly here

       var X: ^Integer;// (X Указатель на Integer) ... New(X);//(Выделить память по адресу X) X^:=50;//(Записать туда число 50) 

      And read more about pointers and addresses.

      • 7
        Do not blame the person for nothing - you will not google the “^” symbol;) - drdaeman
      • one
        SUDDENLY! - karmadro4
      • It is also necessary to know that it is “carriage” (and not circumflex, by the way, the latter is a diacritic, not an independent sign). Although, yes, you can not argue, if you want you can google. (But when I somehow looked for what a combinator <$> was in Haskell - it was funny) - drdaeman
      • It is even on request that the cap in pascal is located :-) In general, I really think that we have already discussed this issue here on stackoverflow.RU - karmadro4