All About C++

Get Pure Concepts of C++

Wednesday, 10 February 2016

how To show data in singly link list in data structure with the example of source code

To display the data from singly link list
Here is a function to display data from single link list
void show()
                        {
            link *temp;
            temp= first;

            cout<<"The list follows:"<<endl<<endl;
            while(temp!=NULL)  // move towards null
            {
                        cout<<temp->data<<" ";
                        temp=temp->next; // same as increment statement as it moves toward null
            }          

}