Function to insert an integer into a circular linked _list in ascending order
<p>I am writing a function to insert an integer into a circular linked _list in ascending order whose elements are sorted in ascending order (smallest to largest).</p>

<p>The input to the function insertSortedList is a pointer start to some node in the circular list and an integer n between 0 and 100. Return a pointer to the newly inserted node.</p>

<p>The structure to follow for a node of the circular linked list is-</p>

<pre><code>Struct CNode;
Typedef struct CNode cnode;
Struct CNode
{
   Int  value;
   Cnode* next;
};
Cnode* insertSortedList (cnode* start,int n)
{
   //WRITE YOUR CODE HERE
}
//FUNCTION SIGNATURE ENDS

Test Case 1:
Input:
[3-&gt;4-&gt;6-&gt;1-&gt;2-&gt;^],5
Expected Return Value:
[5-&gt;6-&gt;1-&gt;2-&gt;3-&gt;4-&gt;^]

Test Case  2:
Input:
[1-&gt;2-&gt;3-&gt;4-&gt;5-&gt;^],0
Expected Return Value:
[0-&gt;1-&gt;2-&gt;3-&gt;4-&gt;5-&gt;^]
</code></pre>

<p>Here's my code:</p>

<pre><code> Cnode* insertSortedList (cnode* start,int n)
 {
 int count=1,i,count1=0;
 Cnode* temp=start;
 Cnode* temp1=start;
 Cnode* temp2=start;
 Cnode* newHead=NULL;

while(temp!=NULL)
 {
temp=temp-&gt;next;
count ++;
}

int arr[count];

while(temp2!=NULL)
 {
    for(j=0;j&lt;count;j++)
    {
        arr[j]=temp-&gt;data;
        temp2=temp2-&gt;next;
     }
}


while(n&gt;=temp2-&gt;value)
{
    temp2=temp2-&gt;next;
 }

 newHead=temp2;

 for(i=0;i&lt;count;i++)
 {
    Cnode* newNode=new Cnode();

    newNode-&gt;data=arr[i];
    newNode-&gt;next=NULL;
 }

}
</code></pre>