Linked List pushback member function implementation
<p>I am a novice programmer and this is my second question on Stack Overflow.</p>

<p>I am trying to implement a pushback function for my Linked List by using a tail pointer. It seems straightforward enough, but I have a nagging feeling that I am forgetting something or that my logic is screwy. Linked Lists are hard!</p>

<p>Here is my code:</p>

<pre><code>template &lt;typename T&gt;
void LinkedList&lt;T&gt;::push_back(const T n)
{
Node *newNode;  // Points to a newly allocated node

// A new node is created and the value that was passed to the function is stored within.
newNode = new Node;
newNode-&gt;mData = n;
newNode-&gt;mNext = nullptr; 
newNode-&gt;mPrev = nullptr;

//If the list is empty, set head to point to the new node.
if (head == nullptr)
{
    head = newNode;
    if (tail == nullptr)
    {
        tail = head;
    }
}
else  // Else set tail to point to the new node.
    tail-&gt;mPrev = newNode;
}
</code></pre>

<p>Thank you for taking the time to read this.</p>