-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
103 lines (76 loc) · 2.06 KB
/
Copy pathmain.c
File metadata and controls
103 lines (76 loc) · 2.06 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
98
99
100
101
102
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "listmanager.h"
int main()
{
NODE* intList;
int intListIndex;
NODE* stringList;
int stringListIndex;
intListIndex = create_list(&intList);
push(&intList,465);
stringListIndex = create_list(&stringList);
push(&stringList, "Hello LinkedList");
push(&stringList, "Hello World");
print_nodes_int(&intList);
printf("\n");
print_nodes_string(&stringList);
dispose();
/*int lenght = 3;
NODE** array;
/// Allocate memory for n amount of NODES
/// Is array, access by []
array = malloc(sizeof(NODE*) * lenght);
for(int i = 0; i < lenght; i++)
{
NODE* current = &array[i];
printf("Data of node: %i\n", i);
if(current->nodeSignature == NODE_nodeSignature)
{
printf("same\n");
}
else
{
printf("not same\n");
}
printf("\n");
}
printf("\n");
/// Create NODES
NODE* intList;
create_list(&intList);
NODE* stringList;
create_node("Programming is epic", &stringList);
NODE* charList;
create_node_empty(&charList);
/// Fill the NODE pointer array with the addresses of the created lists
array[0] = &intList;
array[1] = &stringList;
array[2] = &charList;
/// Test by pushing data in to them
push(array[0], 15);
push(array[0],1337);
push(array[1], "C pointer array is hard");
push(array[1], "C pointers are a mess for me :/");
push(array[2], 'S');
push(array[2], 'I');
push(array[2], 'R');
push(array[2], 'O');
push(array[2], 'B');
/// Print data out using the pointer in the pointer array
print_nodes_int(array[0]);
print_nodes_string(array[1]);
print_nodes_char(array[2]);
/// Clear data out
for(int i = 0; i < lenght; i++)
{
delete_all_nodes(array[i]);
}
//delete_all_nodes(array[0]);
//delete_all_nodes(array[1]);
//delete_all_nodes(array[2]);
/// Clear pointer NODE array
free(array);*/
return 0;
}