From f6a144987cc403de8ad6bddd055f756120f8d405 Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Wed, 17 Apr 2024 16:00:00 -0700 Subject: archival commit --- example/stack.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 example/stack.c (limited to 'example/stack.c') diff --git a/example/stack.c b/example/stack.c new file mode 100644 index 0000000..93128f4 --- /dev/null +++ b/example/stack.c @@ -0,0 +1,20 @@ +typedef double stack_value_t; + +#define STACK_IMPLEMENTATION +#include "../include/stack.h" + +void main() { + stack_t stack = { .capacity = 10 }; + stack_init(&stack); + + for(int i = 0; i < 15; i++) { + stack_push(&stack, (stack_value_t) i); + } + + printf("%lf\n", stack_peek(&stack)); + printf("%lf\n", stack_pop(&stack)); + + for(int i = 0; i < 15; i++) { + printf("%lf\n", stack_pop(&stack)); + } +} \ No newline at end of file -- cgit v1.3.1