Ds 13
Ds 13
struct Node
{
int data;
struct Node *next;
};
void insert(struct Node *);
void delete(struct Node *);
void display(struct Node *);
int main(){
int choice = 0;
struct Node *head = (struct Node *)malloc(sizeof(struct Node));
head->data = 0;
head->next = NULL;
printf("Menu: \n1:Insert an element to the queue.\n)
printf("2:Delete an element from the queue.\n"
printf("3:Display the content of the queue\n 4:Exit\n");
while (choice != 4)
{
printf("\nEnter choice: ");
scanf("%d", &choice);
switch (choice)
{
case 1:
insert(head);
break;
case 2:
delete (head);
break;
case 3:
display(head);
break;
default:
break;
}
}
}
Sample Output
Result
The program was executed and the output verified.