title: C move node in linked list
body: <p>I wrote a program that move a node in a linked list to index according the user choice and i only can move the nodes forward but if the user want to move frame 2 (node 2) to frame 1 (node 1) I have no clue how to do that if someone know how to do that and can help I will realy appreciate that. this is the function</p>
  <pre><code>FrameNode* MovePos(FrameNode* list, int number_of_nodes)
  {
      char name[STR_LEN] = { 0 };
      int index = 0, pos = 1;
      bool flage = false;
      printf(&quot;Enter the name of the frame\n&quot;);
      fgets(name, STR_LEN, stdin);
      name[strcspn(name, &quot;\n&quot;)] = 0;
      flage = searchInList(list, name); // function that search if the name exists in the list
      if (!flage)
      {
          return list;
      }
      printf(&quot;Enter the new index in the movie you wish to place the frame\n&quot;);
      do
      {
          scanf(&quot;%d&quot;, &amp;index);
          getchar();
          if (index &gt; number_of_nodes)
          {
              printf(&quot;please enter number between 1-%d\n&quot;, number_of_nodes);
          }
      } while (index &gt; number_of_nodes);
      FrameNode* p = list;
      FrameNode* prev = p;
      while (strcmp(p-&gt;frame-&gt;name, name))
      {
          prev = p;
          p = p-&gt;next;
          pos++;
      }
      for (int i = pos; i &lt; index; i++)
      {
          prev-&gt;next = p-&gt;next;
          p-&gt;next-&gt;next = p;
      }
      for (int i = pos; i &gt; index; i--)
      {
          // here the code that do that supposed to be
      }
      return list;
  }
  </code></pre>