Traversing through Singly Linked List (SLL)

April 22, 2010 4 Comments » Hits : 42






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

Related Articles:

4 Comments

  1. Anonymous July 4, 2010 at 3:44 pm - Reply

    please give explation that how it will display nodes

  2. Priteh Taral July 5, 2010 at 4:29 am - Reply

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

  3. raj October 4, 2010 at 3:32 am - Reply

    yes please let me know how the nodes are printed

  4. Admin October 4, 2010 at 4:25 am - Reply

    You can Goto This Link :
    http://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

Leave A Response