-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnagra_main.c
65 lines (47 loc) · 1.24 KB
/
nagra_main.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
59
60
61
62
63
64
65
#include <stdio.h>
#include <stdlib.h>
#include "./linear_list/src/linear_list.h"
#include "./queue/src/queue.h"
#include "./stack/src/stack.h"
int main()
{
// #ifdef ENABLE_FEATURE_LINEAR_LIST
LIST *linkedList = createList();
addNode(linkedList, 56);
addNode(linkedList, 79);
addNode(linkedList, 80);
addNode(linkedList, 12);
deleteNode(linkedList, 79);
printList(linkedList);
deleteList(linkedList);
// #endif
//////////////////////////////////////////////////////////////////////////////////
#ifdef ENABLE_FEATURE_QUEUE
Queue *q = (Queue *)malloc(sizeof(Queue));
if (q == NULL)
{
printf("ERROR: malloc failed -> Unable to allocate memory");
return 1;
}
enqueue(q, 56);
enqueue(q, 79);
enqueue(q, 80);
dequeue(q);
printQueue(q);
#endif
#ifdef ENABLE_FEATURE_STACK
StackNode *top = NULL;
// Push elements onto the stack
push(&top, 10);
push(&top, 20);
push(&top, 30);
// Print the stack
printStack(top);
// Pop an element from the stack
pop(&top);
// Print the updated stack
printStack(top);
#endif
/////////////////////////////////////////////////////////////////////////////////////////////
return 0;
}