
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
main()
{
struct node *lst,*p,*start;
int i,n;
start=NULL;
lst=NULL;
printf("Enter the elements you want in your linked list :");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
p=(struct node *)malloc(sizeof(struct node));
printf("Enter the %d element :",i);
scanf("%d",&(p->data));
p->next=NULL;
if(start==NULL)
start=p;
else
lst->next=p;
lst=p;
}
p=start;
printf("Entered linked list is :");
while(p!=NULL)
{
printf(" %d\n ",p->data);
p=p->next;
}
}