Files
odwetalibc/demo.c
T
2023-12-22 16:19:47 +01:00

42 lines
817 B
C

#include <odweta/list.h>
#include <odweta/vector.h>
#include <stdio.h>
int main(int argc, char **argv) {
list_t *l = listInit();
vector_t *to_be_pushed_vec = vectorInit(INT);
vectorPush(to_be_pushed_vec, &(int){1620});
listPush(l, VECTOR, (vector_t *)to_be_pushed_vec);
listPush(l, FLOAT, &(float){3.14});
listPush(l, CHAR, &(char){'x'});
listPush(l, INT, &(int){123});
listPrint(l);
printf("popping for the 1st time\n");
int popped = *((int *)listPop(l));
printf("popped: %d\n", popped);
listPrint(l);
printf("popping for the 2nd time\n");
char cpopped = *((char *)listPop(l));
printf("popped: '%c'\n", cpopped);
listPrint(l);
printf("popping for the 3rd time\n");
float fpopped = *((float *)listPop(l));
printf("popped: %f\n", fpopped);
listPrint(l);
listCleanup(l);
return 0;
}