-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinkedList.c
55 lines (43 loc) · 1.2 KB
/
LinkedList.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
/*
Simanta Kumar Roy
221-35-909
*/
#include<stdio.h>
#include<stdlib.h>
struct Node {
int roll;
int age;
char name;
struct Node* next;
};
int main()
{
struct Node* head = NULL;
struct Node* second = NULL;
struct Node* third = NULL;
head = (struct Node*)malloc(sizeof(struct Node));
second = (struct Node*)malloc(sizeof(struct Node));
third = (struct Node*)malloc(sizeof(struct Node));
struct Node* forth = (struct Node*)malloc(sizeof(struct Node));
head->roll = 1;
head->age = 18;
head->name = 'S';
head->next = second;
second->roll = 2;
second->age = 17;
second->name = 'I';
second->next=third;
third->roll=30;
third->age = 16;
third->name = 'M';
third->next = forth;
forth->roll = 12;
forth->age = 13;
forth->name = 'A';
forth->next = NULL;
printf("Roll %d : Age %d : Name : %c \n",head->roll,head->age,head->name);
printf("Roll %d : Age %d : Name : %c \n",second->roll,second->age,second->name);
printf("Roll %d : Age %d : Name : %c \n",third->roll,third->age,third->name);
printf("Roll %d : Age %d : Name : %c \n",forth->roll,forth->age,forth->name);
}