forked from sarthakd999/Hacktoberfest2021-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
program.c
60 lines (50 loc) · 783 Bytes
/
program.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
#include<stdio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *link;
}*newnode,*start,*last,*temp;
void create()
{
int value,choice;
do{ struct node* newnode=(struct node*)malloc(sizeof(struct node));
printf("enter the vlaue");
scanf("%d",&value);
newnode->info=value;
newnode->link=NULL;//assigning link to null
if(start==NULL)
{
start=newnode;
last=newnode;
}
else
{
last->link=newnode;
last=newnode;
last->link=NULL;
}
//continuing for this
printf("1 to continue");
scanf("%d",&choice);
}
while(choice==1);
}
//displaying the list
void display()
{
printf("\n your link list : ");
temp=start;
while(temp->link!=NULL)
{
printf("%d->",temp->info);
temp=temp->link;
}
printf("%d->",temp->info);
printf("NULL");
}
void main()
{
create();
display();
}