Exp.1.a - Singly Linked List Implementation
Exp.1.a - Singly Linked List Implementation
AIM
To implement singly linked list operations such as create, display, insertion, deletion
PROGRAM
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void create();
void display();
void insert_beg();
void insert_pos();
void insert_end();
void delete_beg();
void delete_end();
void delete_pos();
1
Exp 1.a. SINGLY LINKED LIST IMPLEMENTATION
struct node *head= NULL;
struct node
{
int data;
struct node *next;
};
int main()
{
int choice;
clrscr();
while(1)
{
printf(" 1.Create ");
printf("\n 2.Display");
printf("\n 3.Insert");
printf("\n 4.Delete");
printf("\n 5. Exit");
printf("\nEnter your choice : ");
scanf("%d",&choice);
2
Exp 1.a. SINGLY LINKED LIST IMPLEMENTATION
switch(choice)
{
case 1: create();
break;
case 2: display();
break;
case 3: insert_beg();
break;
case 4: insert_pos();
break;
case 5: insert_end();
break;
case 6: delete_beg();
break;
case 7: delete_end();
break;
case 8: delete_pos();
break;
case 9: exit(0);
3
Exp 1.a. SINGLY LINKED LIST IMPLEMENTATION
default:printf("wrong choice");
break;
}
}
}
12