title: c++ program crashes linked list?
body: <pre><code>                if(tmpPtr-&gt;number&lt;tmpPtr-&gt;next_number-&gt;number)
                  {
                      int tmpV1=tmpPtr-&gt;next_number-&gt;number;
                      int tmpV2=tmpPtr-&gt;number;
                      tmpPtr-&gt;next_number-&gt;number=tmpV2;
                      tmpV2=tmpPtr-&gt;number=tmpV1;
                  }
  </code></pre>
  
  <p>This is what I have tried so far, this is supposed to be sorting the linked list as member are being added each time. But when the compiler crashes when I try to put in the second node. The break point is the if statement, <code>if(tmpPtr-&gt;number&lt;tmpPtr-&gt;next_number-&gt;number)</code>. I tried really hard to figure out what the problem was, but couldnt.</p>