struct node
{int data;
struct node *next;
};
struct node *insert(struct node *,int );
void display(struct node *);
struct node * insert(struct node *head ,int c)
{
struct node *temp;
temp=(struct node *)malloc(sizeof(struct node));
temp->data = c;
if(head == NULL)
{
head = temp;
head->next = NULL;
}
else
{
temp->next = head;
head = temp;
}
return head;
}
void display(struct node *head )
{
struct node *temp;
temp=head;
while(temp != NULL)
{
printf("%d\n",temp->data);
temp=temp->next;
}
}