title: Pointer is not being passed during a linked list swap
body: <p>This will most likely seem like I am missing something obvious but when I try to pass a Linked List pointer to my Selection sort I get a NULL pointer problem. In my C code I have this as my linked list:</p>
  
  <pre><code>typedef struct iorb
  {
      int base_pri;
      struct iorb *link;
      char filler[100];
  } IORB;
  </code></pre>
  
  <p>Then I pass my new linked list into this function after creating it:</p>
  
  <pre><code>void swapNodes(POINTER *head, POINTER CurrentHead, POINTER CurrentMinimum, POINTER TempSwap);
  
  POINTER SortList(POINTER *head, char *SortMethod[])
  {
      POINTER TempHead = *head;
  
      //Only one node, no need to sort.
      if (TempHead-&gt;link == NULL)
      {
          return head;
      }
  
      //Store node with the new minimum value.
      POINTER TempMin = *head;
  
      //Store curent node for swapping
      POINTER TempSwap = *head;
  
      //Transverse the list.
      POINTER TempCurrent;
      for (TempCurrent = *head; TempCurrent-&gt;link != NULL; TempCurrent = TempCurrent-&gt;link)
      {
          //Check if this node has a lower priority than the current minimum and if so, swap them.
          if (TempCurrent-&gt;link-&gt;base_pri &lt; TempMin-&gt;base_pri)
          {
              TempMin = TempCurrent-&gt;link;
              TempSwap = TempCurrent;
          }
      }
  
      //Swap nodes if the head is not the same as the minimum.
      if (TempMin != TempHead)
      {
          swapNodes(&amp;TempHead, TempHead, TempMin, TempSwap);
      }   
  
      //Recursively sort the rest of the list.
  
      //FOR SOME REASON THE NODE POINTER IS NOT BEING PASSED HERE (EMPTY)
      TempHead-&gt;link = SortList(TempHead-&gt;link, *SortMethod);
  
      return head;
  
  }
  
  void swapNodes(POINTER *head, POINTER CurrentHead, POINTER CurrentMinimum, POINTER TempSwap)
  {
      //Set new head as the minimum.
      *head = CurrentMinimum;
  
      //Link the current temp swap to the head.
      TempSwap-&gt;link = CurrentHead;
  
      //Swap pointers.
      POINTER temp = CurrentMinimum-&gt;link;
      CurrentMinimum-&gt;link = CurrentHead-&gt;link;
      CurrentHead-&gt;link = temp;
  }
  </code></pre>
  
  <p>I am not sure why it is isn't being passed back into the same function, when I debug the linked list seems okay. I suspect that I am missing something in the swap node function, but I don't quite understand what this is. Can someone please offer some insight as to how this code should go for swapping the nodes around?</p>
  
  <p>If you need additional information please let me know.</p>