Insertion in linked list creating loop
<p>So, I am trying to implement a simple linked list in C++, but I am having a problem with the push method of my class. Basically, when I add the first node to a list, everything goes fine; but, when I add a second node, it ends up pointing to itself (ie, secondNode.next == &amp;secondNode).</p>

<pre><code>class linkedList
{
    public:
    node head;
    linkedList()
    {
        head.next = NULL;
    }
    void push(node new)
    {
        if(head.next == NULL)
        {
            head.next = &amp;new;
            new.next = NULL;
        }
        else
        {
            new.next = head.next;
            head.next = &amp;new;
        }
    }
};
</code></pre>

<p>I couldn't figure out what is wrong... Any help would be greatly appreciated.</p>
