top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to delete a node in single linked list?

+3 votes
698 views

How to delete the node that given as argument in single linked list?
Is there any system call to get prev pointer ?

Note: Here the goal is to delete the address not the node's value

posted Mar 9, 2014 by sivanraj

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

No in C we don't have a system call to get the previous pointer of a singly linklist node.
Perfect case of publishing an article...i.e. Single LinkList Implementation.

answer Mar 9, 2014 by Meenal Mishra
I guess, in worst case we can start to search in heap and find..  Any other way..
0 votes

If we delete first node then use follow code

void deletenode()
{
    struct node *r;
    if(start==NULL)
    {
        printf("List is empty\n");
    }
    else
    {
        r=start;
        start=start->link;
        free(r);
    }
}
answer Apr 22, 2016 by Ajay Kumar
...