Display Singly Linked List from First to Last

April 22, 2010 1 Comment » Hits : 37






Display Singly Linked List from First to Last


  1. Traversal Starts from Very First node
  2. In order to traverse from start to end you should assign Address of Starting node in Pointer variable
temp=start;
  1. Travers Linked List Until temp!=NULL
  2. Print Value in each Iteration with the help of (temp->data)
while(temp!=NULL)
    {
    printf("%d",temp->data);
    temp=temp->next;
    }

Program :

void display()
{
    struct node *temp;
    temp=start;
    while(temp!=NULL)
    {
    printf("%d",temp->data);
    temp=temp->next;
    }
}

Image From : http://www.academictutorials.com/images/linked_list.gif

Related Articles:

One Comment

  1. uttam singh September 9, 2010 at 8:58 pm - Reply

    thnx:)

Leave A Response