On 06/03/2015 01:28 PM, Paul wrote:

> Ooops, this is what I meant to post:
>
> struct CoOrd
> {
>      int x, y;
> }
>
> CoOrd[][NumPaths]pathList;
>
>
> I append values like so...
>
> pathList[][n] ~= CoOrd(cX, cY);

I don't think you need the empty [] there. pathList[n] is one of the paths and you are adding a coordinate to it:

    pathList[n] ~= CoOrd(cX, cY);

> But to get the expected values, I need to access them like this example
> for last x co-ord of last item:
>
>
> int xx = pathList[NumPaths-1][$ - 1].x;
>
>
> Doesn't seem right (but it works)...

I makes perfect sense! ;) pathList[NumPaths-1] is the last path and you are accessing the last coordinate in it. C did it wrong. Luckily, I've always found C's syntax unbelievably backward (or inside-out?).

Ali

Reply via email to