Example and README added

This commit is contained in:
Soikk 2022-01-28 22:30:34 +01:00
parent 5d47f26c57
commit d21916ff6e
2 changed files with 26 additions and 0 deletions

1
README.md Normal file

@ -0,0 +1 @@
Usage of list shown in "test.c"

25
test.c Normal file

@ -0,0 +1,25 @@
// Usage of list
#include <stdio.h>
#include <stdlib.h>
#include "../libs/llist.h"
typedef struct{
int a;
double b;
} st;
int main(){
st s1 = {.a = 1, .b = 2.0};
double c = 3.0;
node *n1 = Node(&s1, sizeof s1);
llist l = Llist("lista", NULL);
insert(&l, n1);
//l.head = n1;
printf("%d\n%f\n", ((st*)l.head->data)->a, s1.b);
return 0;
}