Display Singly Linked List from First to Last

April 22, 2025 1 Comment Hits : 602





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

Incoming search terms: