Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6139201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:57:34+00:00 2026-05-23T17:57:34+00:00

Below is a simple example of using pointer in delphi. Type TRecord1 = Record

  • 0

Below is a simple example of using pointer in delphi.

Type

TRecord1 = Record
field1 : String;

end; 

procedure TForm1.Button2Click(Sender: TObject);
var
   Rec : TRecord1;
   Ptr: ^TRecord1;

begin
   Rec.field1:= 'field1';
   Ptr := @Rec;
   memo1.Lines.Add (Ptr^.field1); 
   memo1.Lines.Add (Ptr.field1); // it also works.

 end;

In such case, Ptr^ and Ptr both work. It seems delphi is to allow user more flexibility in pointing to the value. But just by reading the two lines, they are syntactically different and may mean differently. In such case both work. But my question is:

  1. how can a user know in other situations where ^ can or can not be
    omitted or, where with ^ or without ^ means the same or differently?
  2. What are those situations ? Examples will be appreciated.
  3. Why? (Optional)

Thanks a lot in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:57:35+00:00Added an answer on May 23, 2026 at 5:57 pm

    how can a user know in other situations where ^ can or can not be omitted or, where with ^ or without ^ means the same or differently?

    What are those situations ? Examples will be appreciated.

    A plain Pointer doesn’t have any fields or properties, so ignoring Delphi’s smarts, the Pointer.Field syntax doesn’t make sense. Because of that there can’t be a conflict between Pointer^.Field and Pointer.Field, simply because the plain . syntax is meaningless if you don’t dereference the pointer.

    If the type pointed to by the pointer doesn’t have any fields you have to use the ^ syntax. That is, when the pointer is a pointer to a basic type, or is an untyped pointer.

    Why? (Optional)

    Class instance references (what most people would call "objects") are also pointers in Delphi, I assume the syntax was introduced to make working with Pointers less verbose and more like using classes. It’s also harmless, because as mentioned above, the compiler can’t get it wrong.

    I personally prefer the ^. syntax, because it makes it clear I’m working with a pointer and not a record or class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below I'm using simple example, real tables are bigger, I cannot store devices in
Below is a simple example using gtk2hs that adds a label and then a
Using the simple example below, what is the best way to return results from
In the below 'simple' Ajax login example, I'm using JQuery to submit form params
Below I have a very simple example of what I'm trying to do. I
I followed a simple example as below. But compile failed. Could you please have
Please See The Simple Example Below For Understanding My situation. (Attention To Comments Inside
Consider this simple example code: <form name=text id=frm1 method=post> <input type=checkbox name=name[] value=1000> Chk1<br>
Below is a simple example of how I'm reading from a plist and displaying
Can someone explain the statement below to me with a working sample/example. thanks in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.