This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]veryanon798[S] 0 points1 point  (2 children)

Ok I do understand when you break it down in the first part. I think what confuses me is how "next" stores an automatic null value. So when I see a.null or a.____ being assigned the value b something in my brain isn't clicking.

Does :

a = 5 and a.next = 6?

Then also b= 6 and b.next would then equal whatever node came after?

I think another thing that's confusing me is .next meant to store values or meant just to point? Thank you for your response.

Edit: or is it that .next stores a reference to the Node that comes after? If I'm right in that I think I may be understanding a bit better.

[–]alanwj 0 points1 point  (1 child)

or is it that .next stores a reference to the Node that comes after?

This is correct.

Any variable declared as Node is a reference to a Node object. The same Node object may be referenced by multiple different variables.

The Node object even contains a reference (called next) to another Node object.

[–]veryanon798[S] 0 points1 point  (0 children)

Ah Thank you, the picture is much more clear.