title: Return Pointer of any selected index in circular singly linked list
body: <p>I designed this code so that I can get a pointer of any position that user wants in a circular singly linked list, I am using cout to return pointer, I want such a mechanism that I can use it with my other function instead of re writing the whole code again, for that I need to do something with return type which is void right now </p>
  
  <p>Here is the function ..</p>
  
  <pre><code>void pointer_to_node(int index){
      Node*temptr;
      temptr = new Node;
      temptr = firstptr;
  
      Node*temptr2;
      temptr2 = new Node;
      temptr2 = NULL;
      int count = 1;
  
      while (temptr!=temptr2){
          if(count==index){
              cout &lt;&lt; "Required Pointer is : ";
              cout&lt;&lt; temptr;}
  
          count++;
          temptr2=firstptr;
          temptr=temptr-&gt;nextptr;
      }
  
      if (index&gt;size_of_list())
      {
          temptr=NULL;
          cout&lt;&lt; "Can't You think in bounds. Take your NULL Pointer ";
          cout &lt;&lt; temptr;
          delete temptr;
          delete temptr2;
      }
  }
  </code></pre>