title: How to add element in linkedlist without checking any condition of isEmpty() Function in c++
body: <p>I wanna know that how to add any element in single or double linkedlist without checking <code>isEmpty()</code> function</p>
  
  <pre><code>bool LinkedList&lt;T&gt;::addAtEnd(T ele) {
      bool bSuccess = false;
      Node&lt;T&gt; * t = new Node&lt;T&gt;;
      t-&gt;SetData(ele);      
      if (empty()) {
          t-&gt;SetNext(NULL);
          head = t;
          tail = t;
          count++;
          bSuccess = true;
      }
      else {
          t-&gt;SetNext(NULL);
          tail-&gt;SetNext(t);
          tail = t;
          count++;
          bSuccess = true;
      }
  }
  </code></pre>