0

am trying to figure out how to insert a new number in a linked list after a specified number...i am failing to figure out how to fix in the number in the list...here is the partial code..any help is appreciated

```
void insert(detailsPtr& head)
{
detailsPtr prev, current,tmp;
int num,curr_num;
cout<<"Enter the number which you want your new number to follow:";
cin >> curr_num;
cout<<"Enter the number to insert: ";
cin >> num;
cout<< endl;
prev=head;
current=prev->link;
while(prev->link!=NULL)
{
if(prev->prod_id==curr_num)
{
tmp= new details;
tmp->prod_id=num;
tmp->link=current;
prev->link=tmp;
}
if(prev->link==NULL)
{
cout<<"The number you entered cannot be found"<<endl;
}
}
}
```