-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLISTMOH1.C
53 lines (48 loc) · 892 Bytes
/
LISTMOH1.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
#include<stdio.h>
#include<conio.h>
#include<string.h>
#define NULL 0
struct class{
char name[40];
long int roll;
struct class *next;
};
typedef struct class node;
void create(node *record);
void display(node *record);
void main()
{
node *start;
start=(node*)malloc(sizeof(node));
create(start);
printf("\n");
display(start);
}
void create(node *record)
{
char u;
fflush(stdin);
printf("enter the name");
scanf("%[^\n]",record->name);
printf("enter the rollno");
fflush(stdin);
scanf("%ld",&record->roll);
fflush(stdin);
printf("want to enter more data");
printf("type y for yes & n for no");
fflush(stdin);
scanf("%c",&u);
if (u=='y')
{
record->next=(node*)malloc(sizeof(node));
create(record->next);}
else
record->next=NULL;
}
void display(node *record)
{
printf("%s",record->name);
printf("\n%ld",record->roll);
if(record->next!=NULL)
display(record->next);
}