title: How to swap nodes in a linked list without swapping data in C language?
body: <p>I use this sorting function, but I don't know how to swap node addresses instead of values. I use doubly linked list.</p>
  
  <p>Thank you</p>
  
  <pre><code>void sort(LISTnode **h) {
      LISTnode * start, * min, * temp;
      int num;
      start = *h;
      while (start-&gt;next != NULL) {
          temp = start;
          min = temp;
          temp = temp-&gt;next;
  
          while (temp != NULL) {
              if (temp-&gt;number &lt; min-&gt;number)
                  min = temp;
                  temp = temp-&gt;next;
          }
  
          // This part of the code
          num = min-&gt;number;
          min-&gt;number = start-&gt;number;
          start-&gt;number = num;
  
          start = start-&gt;next;
      }    
  }
  </code></pre>