Array access via pointer

Moritz Warning moritzwarning at
Sun May 30 12:50:10 PDT 2010

On Sun, 30 May 2010 21:43:16 +0200, Robert wrote:

> Hi, I hope some of you D gurus can help me getting my mind setup correct
> when using D arrays.
> I have an array: data[1 .. 2048] of type ubyte
> I'm interested in getting the addresse of the array and its data
> members. So I used:
> writefln("adress data[%d] = %d", 0, &data);

try data.ptr instead of &data.
Think of a dynamic array as a struct of a length value (.length) and a 
pointer (.ptr).

More information about the Digitalmars-d mailing list