Traversing through Singly Linked List (SLL)

April 22, 2025 4 Comments » Hits : 671





Traversing through Singly Linked List (SLL)
Basic Node Structure : Click Here
Traversing Linked List means move to First node , Perform certain Operation and then switch to next node . This process continue until temp = NULL

temp = start; //Move to First Node
do {
    // Do Your Operation
    // Statement ...1
    // Statement ...2
    // Statement ...3
    // Statement ...n
    temp = temp->next; //Move Pointer to Next Node
}while(temp!=NULL);

Explanation : [ Updated ..... ]

Initially

temp = start;
  • Store Address of Starting node into “temp
  • Print data stored in the node “temp
  • Once Data stored in the temp is printed, move pointer to the next location so that “temp” will contain address of 2nd node.

Special Note :

  • In Singly Linked List Program , do not change start index un-necessarily because we must have something that can store address of Head node

Incoming search terms:

  • Anonymous

    please give explation that how it will display nodes

  • Priteh Taral

    @ Anonymous
    Thank You !!!
    I have Updated Post , Explanation is given in the post

  • raj

    yes please let me know how the nodes are printed

  • Admin

    You can Goto This Link :
    https://www.c4learn.com/2010/04/display-singly-linked-list-from-first.html

    OR

    In the Sidebar -> Click On Linked List to Explore More Topics Regarding Linked List