0

hi;

I'm trying to program a circular link list with a head node , I have a problem with insert function .

wanting to do it like this but with a head node

>> http://geeksforgeeks.org/wp-content/uploads/cll1.gif

this is my function ::

```
struct node{
int data;
node *next;
node(int x,node *n=NULL){
data=x;
next=n;
}
};
void insert (node *h,int d){
node *p=h;
while (p->next!=h && d>p->next->data)
p=p->next;
p->next =new node(d,p->next);
}
```