why $ is need to access array [negative index]?

mw mingwu at gmail.com
Fri Sep 18 21:12:12 UTC 2020


On Friday, 18 September 2020 at 20:57:04 UTC, bachmeier wrote:
> I forgot to add when discussing C, that D already has negative 
> index values, which mean something completely different than 
> Python's usage:
>
> double[] x = [1, 2, 3, 4];
> double * y = &(x.ptr)[2];
> writeln(y[-2]); // 1

This is using array index syntax on a raw pointer.


More information about the Digitalmars-d mailing list