/* Created by Anjuta version 1.2.0 */
/*	This file will not be overwritten */

#include <stdio.h>

struct	S_Link_List{
	int data;
	struct S_Link_List *next_node;
};

typedef struct S_Link_List n_struct;
int main()
{

	
	//This will hold place of the first node.
	//From here we can begin traversing the list using next_node property to point to a header node
	//header node will save address of first node if exist.
	//You will use this dynamically allocated list instead of array
	n_struct first;
	n_struct * head;

	
	//Allocating some space in memory, up to now head that is a pointer does not occupy and space in memory
	head=(n_struct *)malloc(sizeof(n_struct));
	
	//init first and head.
	first.next_node=head;
	head->next_node=NULL;
	
	
	//You will define node as a pointer to S_Link_List. It will be the current node for work on each step.
	n_struct  * curr;
	
	
	

	

	int tmp;
	
	
	
	printf( "Enter Number\n");
	scanf( "%d", &tmp);
	while ( tmp  != 3 ) {
    
		//Now that we want to store a number, allocating some space in memory for curr
		curr = (n_struct *)malloc(sizeof(n_struct));
		
		//specify the curr properties.
		curr->data=tmp;
		curr->next_node=NULL;
		
		
		//Now head next_node property will store the address of curr.
		head->next_node=curr;
		
		//We will make head the curr for using in next step. we are making a chain of link by this method
		head=curr;
		
		
		
        printf( "Enter Number\n");
        scanf( "%d", &tmp);
	}


	//Writing liste
	
	curr=first.next_node->next_node;
	while(curr!=NULL)
	{
		printf( "%d\n",curr->data);
		curr=curr->next_node;
	}

	printf("Hello world\n");
	return (0);
}
