Array of pointers

Rene Zwanenburg renezwanenburg at gmail.com
Thu Jan 16 01:47:19 PST 2014


On Thursday, 16 January 2014 at 09:03:00 UTC, Arjan Fetahu wrote:
> On Thursday, 16 January 2014 at 09:00:18 UTC, Namespace wrote:
>> On Thursday, 16 January 2014 at 08:55:43 UTC, Arjan Fetahu 
>> wrote:
>>> Hi. I started my first program in D (I have a little 
>>> experience in c).
>>> I wanted to create an array of pointers for creating a node 
>>> with multiple
>>> connections. In C you can make one directly (node 
>>> *nedePtr[]). What is the equivalent for the D's syntax??
>>>
>>> Regards
>>> Arjan
>>
>> node*[] nedePtr;
>
> Ok. Thank You!

Keep in mind that, unlike in c++, D classes are reference types:

class Node
{
     Node[] nodes; // This is valid
}

Structs are value types though, so using a struct in the above 
example is illegal.


More information about the Digitalmars-d-learn mailing list