title: I am not getting linked list ouput
body: <pre class="lang-cpp prettyprint-override"><code>#include&lt;iostream&gt;
  using namespace std;
  
  struct Node {
    int data;
    Node* link;
  };
  
  int main(){
    Node * A;
    A=NULL;
    Node* temp=new Node(); // first node;
    temp-&gt;data=4;
    temp-&gt;link=NULL;
    A=temp;
  
    temp=new Node();
    temp-&gt;data=5;
    temp-&gt;link=NULL;
  
    Node* temp1=A;
    while(temp1-&gt;link!=NULL){
      cout&lt;&lt;temp1-&gt;data;
      temp1=temp1-&gt;link;
    }
  }
  </code></pre>
  
  <p>The given program is not showing all the elements of the linked list. I am having problem in identifying the error. At first I initialized the head with a <code>null</code> value then made a temporary variable and assigned it an integer value and pointer to the next node.</p>