Address of an array

David via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Oct 27 09:13:34 PDT 2016


Hi

The pointer (.ptr) of an array is the address of the first array 
element. But what exactly is the address of the array? And how is 
it used?

   auto myArray = [5, 10, 15, 20, 25, 30, 35];
   writeln("myArray.ptr: ", myArray.ptr); // myArray.ptr: 
7FFA95F29000
   writeln("&myArray[0]: ", &myArray[0]); // &myArray[0]: 
7FFA95F29000
   writeln("&myArray: ", &myArray); // &myArray: 7FFE4B576B10
   writeln("*&myArray: ", *&myArray); // *&myArray: [5, 10, 15, 
20, 25, 30, 35]












More information about the Digitalmars-d-learn mailing list