Range violation error in the code
Ishan Thilina
ishanthilina at gmail.com
Tue Apr 12 09:21:06 PDT 2011
-Christian Manning wrote:
>Seems like Node*[] pointers needs to have a defined length before
>allocating to an index as adding "++pointers.length;" before
>"pointers[i]=n;" makes it work fine.
Thanks, it works...!
-Denis wrote:
>There is no node in pointers as of now, thus pointers[i] can only be a range
>violation, whatever i (even 0, which should point to the *first* node).
> pointers[i]=n;
>would *change* the current element number i. To put a *new* node into pointers,
>if that's what you intended, use the '~' appending operator (here in version >'~=');
> pointers ~= n;
Yes, that's exactly what I wanted to do. Thanks...!
More information about the Digitalmars-d-learn
mailing list