Yes - that's right. There are a number of quirks about using pointers in
Delphi, although there are ways to do what you want.

Look at this tutorial:
http://www.delphibasics.co.uk/Article.asp?Name=Pointers (and thanks to
Neil Moffat for his useful site.)

Also see Delphi Help Topic "Overview of Pointers" (Search for Pointers
in the Index) for more details.

For example - pointer addition: Depending on the pointer type, you
cannot just say Ptr:=Ptr+12; to point 12 bytes further on. But you can
say Inc(Ptr,12);


Regards,
       Brendan Blake.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Jack
Sent: 19 January 2006 03:40
To: 'Borland's Delphi Discussion List'
Subject: Pointer Operation?

Hello all,

I thought pointer Delphi was as flexible as pointers in C.
I just realize that it is not. Or I haven't figured out how
to use pointers.

In C, I can randomly access any element in a memory block.
For example, I can do this:

  int a[10], *pi, i;
  pi = a;
  for(i = 0; i < sizeof(a); i++)
    printf("%d\n", *(p + i));

Is it possible to access memory in this fashion

  *(p + i)
  
using pointers in Delphi? It seems that it's only possible
with PChar, but not for pointers for any other data types.
Is that right?

-- 
Best regards,
Jack

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to