title: How do I assign a pointer to a record element using an existing pointer?
body: <p>I understand the concept of pointers and how to use, but I just want to clear up a bit of confusion in my head about assigning a pointer to a record sub-element already pointed to by another pointer...</p>
  <p>I've seen some questions elsewhere that are I think asking the same thing, but the answers are in C...</p>
  <p>If I have:</p>
  <pre><code>type
    TDetails = record
       Name : string;
       Origin : string;
    end;
  
    TMsgData = record
       ID : string;
       Code : integer;
       Details : TDetails;
    end;
  
  var
    MessageData = array of TMsgData;
  </code></pre>
  <p>I can obviously get a pointer to specific record of TMsgData type by:</p>
  <pre><code>var
    pMessageData = ^TMsgData;
  
  begin
    pMessageData := @MessageData[0];
  ...
  </code></pre>
  <p>And of course I can then access all the record elements using that pointer with standard dereferencing.</p>
  <p>But, how do I get a new pointer to just the Details record of MessageData[0] using the first pointer? I want to avoid having a pointer to a pointer so if pMessageData is free'd I still have the other pointer.</p>
  <p>If I do</p>
  <pre><code>name := pMessageData.Details.Name;
  </code></pre>
  <p>then Delphi will automatically dereference this to give me the value of name. So if I did:</p>
  <pre><code>var
    pMessageDetails = ^TDetails;
  
  begin
    pMessageDetails = @pMessageData.Details;
  
  *or*
  
    pMessageDetails = Addr(pMessageData^.Details);
  </code></pre>
  <p>Do either of those give me a pointer to a pointer or a new pointer to the original record?</p>