top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

how to find the Node in linked list without using Null?

+5 votes
273 views
how to find the Node in linked list without using Null?
posted Oct 9, 2013 by Giri Prasad

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

2 Answers

+3 votes
node *find_node (node *head, int data)
{
    for (; head; head=head->next)
        if(data == head->data)
            break;

    return head;
}
answer Oct 12, 2013 by Vikas Upadhyay
+2 votes

try something like this (no null)

while (node)
{
// if it is desired node 
//    break ;
// else
//    node=node->next;
}
answer Oct 9, 2013 by Salil Agrawal
Similar Questions
+2 votes

How to find the median of simple linked list and add a node after it? C program would be helpful?

+3 votes

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

...