#include<stdio.h>
struct node
{
int data;
struct node*next;
};
typedef struct node node;
node *start==NULL;
node* create();
void display();
node* getnode();
int main()
{
int n;
node *list
node *list1=NULL,*list2=NULL;
printf("create list1 ");
list1=create();
printf("create list2");
list2=create();
printf("displaying the list1");
display(list1);
printf("displaying the list2");
display(list2);
return 0;
}
node* getnode()
{
node *newnode=(node*)malloc(sizeof(node));
printf("enter data into node");
scanf("%d",newnode->data);
newnode->next=NULL;
return newnode;
}
node*create()
{
int n,i,;
printf("enter no of nodes to enter");
scanf("%d",&n);
newnode=getnode();
for(i=0;i<n;i++)
{
if(start==NULL)
{
start=newnode;
}
else
{
temp=start;
while(temp->next!=NULL)
{
temp=temp->next;
temp->next=newnode;
}
return list;
}
node*display(list)
{
node*temp;
temp=start;
if(start==NULL);
{
printf("empty list");
}
else
{
while(temp!=NULL)
{
printf("%d->",temp->data);
temp=temp->next;
}
printf("x");
}
}