From 96ecf29e8be977f51f351308ef2c7c492bb829aa Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Tue, 9 Jun 2026 01:17:41 +0400 Subject: refactor --- example/pushdown.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'example/pushdown.c') diff --git a/example/pushdown.c b/example/pushdown.c index ada8d73..bd34bb8 100644 --- a/example/pushdown.c +++ b/example/pushdown.c @@ -1,13 +1,20 @@ -typedef double pushdown_value_t; +// pushdown.c - Example usage of pushdown.h stack automaton + +#include + +typedef double stack_value_t; #define STACK_IMPLEMENTATION +#include "../include/stack.h" + +typedef double pushdown_value_t; #define PUSHDOWN_IMPLEMENTATION #include "../include/pushdown.h" int main() { pushdown_instruction_t instructions[] = {PUSH, COPY, MUL, END}; - stack_t input = {}; - stack_t output = {}; + stack_t input = {0}; + stack_t output = {0}; stack_init(&input); stack_init(&output); @@ -19,4 +26,7 @@ int main() { while (output.size) { printf("%lf\n", stack_pop(&output)); } + + stack_free(&input); + stack_free(&output); } \ No newline at end of file -- cgit v1.3.1