forked from msbhanuprakash940/linkedlist
-
Notifications
You must be signed in to change notification settings - Fork 2
/
linkedls.c
63 lines (48 loc) · 1 KB
/
linkedls.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<stdio.h>
struct node
{int num;
struct node *link;
};
void insert(struct node **,int);
void delete(struct node **,int);
int search(struct node *,int);
void sort(struct node **);
int main()
{struct node *top;
top=NULL;
char ch;
do
{
printf("1.insert\n2.delete\n3.search\n4.sort\n");
printf("enter your option\n");
int n;
scanf("%d",&n);
switch(n)
{case 1:
{int i;
printf("enter the no.to be inserted\n ");
scanf("%d",&i);
insert(&top,i);
break;}
case 2:
{int d;
printf("enter the no.to be deleted\n ");
scanf("%d",&d);
delete(&top,d);
break;}
case 3:
{int s;
printf("enter the no.to be searched\n");
scanf("%d",&s);
search(top,s);
break;}
case 4:
{sort(&top);
break;}
default:
printf("enter a valid option\n");
}
printf("enter 'y' for doing again, else 'n'\n");
scanf("%c",&ch);
}while(ch=='y');
}