-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircular_sll.c
More file actions
57 lines (57 loc) · 888 Bytes
/
circular_sll.c
File metadata and controls
57 lines (57 loc) · 888 Bytes
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
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int info;
struct node * next;
};
typedef struct node* nodep;
nodep start=NULL;
nodep create();
nodep add();
void display(nodep);
int main()
{
nodep t;
t=add();
display(t);
return 0;
}
nodep create()
{
nodep t;
t=(nodep)malloc(sizeof(struct node));
t->next=t;
printf("Enter data\n");
scanf("%d",&t->info);
return t;
}
nodep add()
{
nodep t,t1;
char ch;
printf("Creation of list:\n");
do{
t=create();
if(start==NULL)
start=t;
else
t1->next=t;
t1=t;
printf("Do you want to continue(y/y):");
scanf(" %c",&ch);
}while(ch=='y' || ch=='Y');
t1->next=start;
return start;
}
void display(nodep start)
{
nodep t;
t=start;
printf("The list is:\n");
do{
printf("%d\t",t->info);
t=t->next;
}while(t!=start);
}