memcpy in D

Ali Çehreli acehreli at yahoo.com
Mon Jul 1 15:28:47 PDT 2013


On 07/01/2013 03:23 PM, Tyro[17] wrote:

 > So just to confirm my understanding: Because the address at memory is
 > casted to ushort* in defining base, every iteration of the foreach loop
 > advances the pointer two bytes into the array?

Yes. The incerement operator on a pointer advances the pointer to point 
at the next element. Automatic! :)

Same with arithmetic operations. (ptr + 1) is the address value that 
points at the next element.

Ali



More information about the Digitalmars-d-learn mailing list