Display Singly Linked List from First to Last
- Traversal Starts from Very First node
- In order to traverse from start to end you should assign Address of Starting node in Pointer variable
temp=start;
- Travers Linked List Until temp!=NULL
- 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