-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram166.c
More file actions
97 lines (78 loc) · 1.8 KB
/
Program166.c
File metadata and controls
97 lines (78 loc) · 1.8 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include<stdio.h>
#include<stdlib.h>
#pragma pack(1)
struct node
{
int data;
struct node *next;
};
typedef struct node NODE;
typedef struct node * PNODE;
typedef struct node ** PPNODE;
void InsertFirst(PPNODE First, int No)
{
// Step1 : Allocate the memory for new node
PNODE newn = (PNODE)malloc(sizeof(NODE));
// Step2: Initialise the node
newn->data = No;
newn->next = NULL;
// Step3: Check Linked list is empty or not
if(*First == NULL)
{
*First = newn;
}
else // If linked list contains atleast one node
{
newn->next = *First;
*First = newn;
}
}
void Display(PNODE First)
{
// Logic
}
int main()
{
PNODE Head = NULL;
InsertFirst(&Head, 51);
InsertFirst(&Head, 21);
InsertFirst(&Head, 11);
Display(Head);
return 0;
}
/*
void InsertFirst(PPNODE First, int No)
void InsertLast(PPNODE First, int No)
void InsertAtPos(PPNODE First,, int No, int Pos)
void DeleteFirst(PPNODE First)
void DeleteLast(PPNODE First)
void DeleteAtPos(PPNODE First, int Pos)
void Display(PNODE First)
int Count(PNODE First)
*/
////////////////////////////////////////////////////
/*
InsertFirst(&Head,11)
InsertLast(&Head,11)
InsertAtPos(&Head,11,5)
DeleteFirst(&Head)
DeleteLast(&Head)
DeleteAtPos(&Head,5)
Display(Head)
Count(Head)
*/
/*
Topics to read from C programming for Data structures
Premitive data types
Size of all data types
Loops (while & for)
Dynamic memory (malloc & calloc)
pointer and its types
pointer to pointer
Call by value and call by address
Structure declaration
self referential structure
Memory allocation of structure
Direct and indirect accsing of structure
typdef and its use
*/