link list

Discussion in 'C' started by answerme, Mar 31, 2008.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    Hi
    Below code is for inserting data to the front of the node ,just wanted to know we have reassigned start = tmp ,i.e. start will point to the inserted node which is now new first node but how


    Code:
    int add_begin(int data)
    	{
    			struct node *tmp;
    			tmp=malloc(sizeof(struct node));
    			
    			tmp->info=data;// put data
    			tmp->link=start;// point to nxt node 
    		[B]	start=tmp; // start will point to inserted node [/B]		
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice