aboutsummaryrefslogtreecommitdiff
path: root/demo/main.c
blob: 46fce13493f77c406c995cb020320e495df9f04f (plain)
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
#include "../src/ll.h"

int main() {
  int val = 7;
  Node* head = llnode(val);
  /* printf("Init with %i:\t", val); */
  /* llprint(head); */

  /* val = 12; */
  /* llpush(&head, val); */
  /* printf("Push %i:\t", val); */
  /* llprint(head); */

  /* val = 99; */
  /* printf("Append %i:\t", val); */
  /* llappend(head,val); */
  /* llprint(head); */

  /* val = 45; */
  /* printf("Insert %i:\t", val); */
  /* llinsert(&head, val, 2); */
  /* llprint(head); */

  /* val = 42; */
  /* printf("Insert %i:\t", val); */
  /* llinsert(&head, val, 1); */
  /* llprint(head); */

  /* printf("Pop %i:\t\t", llpop(&head)); */
  /* llprint(head); */

  /* printf("Remove %i:\t",llrmlast(&head)); */
  /* llprint(head); */

  /* printf("Remove %i:\t",llrm(&head,1)); */
  /* llprint(head); */

  /* llvprint(head); */

  head->next = llnode(14);
  head->next->next = llnode(22);
  llfree(&head);
  llprint(head);
  printf("Length: %i\n", lllength(head));
}