Hey!
We have to write a function that deletes nodes from a linked list. I was wondering if you could tell me if this is correct, and if not, how I could fix it?
void delNeg(node * L)
{
node *cur = L;
node *prev = NULL;
while(cur != NULL)
{
if(cur->info < 0)
{
prev = cur;
cur = cur->link;
delete prev;
}
else
{
prev=cur;
cur=cur->link;
}
}
}