Program8
Program8
8 Design, Develop and Implement a menu driven Program in C for the following
operations on Doubly Linked List (DLL) of Employee Data with
the fields: SSN, Name, Dept, Designation, Sal, PhNo
a. Create a DLL of N Employees Data by using end insertion.
b. Display the status of DLL and count the number of nodes in it
c. Perform Insertion and Deletion at End of DLL
d. Perform Insertion and Deletion at Front of DLL
e. Demonstrate how this DLL can be used as Double Ended Queue
f. Exit
*/
#include<stdio.h>
#include<stdlib.h>
void main()
{
int ch;
HEAD *head = (HEAD *) malloc(sizeof(HEAD));
head->count = 0;
head->llink = NULL;
head->rlink = NULL;
for(;;)
{
printf("\n\nMenu\n");
printf("\n1. Insert Front\n2. Insert Rear\n3. Delete Front\n4. Delete
Rear\n5. Display\n6. Exit\n");
scanf("%d", &ch);
switch(ch)
{
case 1:
insfront(head);
break;
case 2:
insrear(head);
break;
case 3:
if(head->rlink == NULL)
printf("List Empty");
else
delfront(head);
break;
case 4:
if(head->rlink == NULL)
printf("List Empty");
else
delrear(head);
break;
case 5:
if(head->rlink == NULL)
printf("List Empty");
else
display(head);
break;
case 6:
exit(0);
}
}
}
NODE *getNode()
{
NODE *temp = (NODE *) malloc(sizeof(NODE));
if(temp == NULL)
{
printf("No Memory\n");
exit(0);
}
return temp;
}
}
}