-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathd1.c
45 lines (42 loc) · 1.01 KB
/
d1.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
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
struct node
{ int data;
struct node *nxt;
}*head,*newnode,*prenode,*ptr;
void llmake()
{ int i=1;
char j;
head=(struct node *)malloc(sizeof(struct node));
printf("Input data for node %d : ",i);
scanf("%d",&head->data);
head->nxt=NULL;
prenode=head;()
{ int i=1;
ptr=head;
printf("\n\nLinked list is :-\n");
do
{ printf("---------------------------------\n");
printf("| Node | Data | Address | Next |\n");
printf("---------------------------------\n");
printf("| %d | %d | %d | %d |\n",i,ptr->data,ptr,ptr->nxt);
printf("---------------------------------\n");
if(ptr->nxt!=NULL)
{ printf(" |\n");
printf(" v\n");
}
ptr=ptr->nxt;
i++;
delay(750);
}while(ptr!=NULL);
}
void main()
{ clrscr();
printf("LL creation :-\n\n");
llmake();
displaycll();
printf("\nPress any key to EXIT...");
getch();
}