From 77ad2a6f6ebf1fdc1a644bce49780649ebe84b58 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Thu, 22 Jul 2021 12:10:57 +0200 Subject: [PATCH] cleanup old code --- day18/ex12-c.c | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/day18/ex12-c.c b/day18/ex12-c.c index aa47581..77e0a68 100644 --- a/day18/ex12-c.c +++ b/day18/ex12-c.c @@ -42,10 +42,12 @@ static int prio_1(long op) { return op==T_PLUS || op==T_MULT? 1: 0; } + static int prio_2(long op) { return op==T_PLUS? 2: op==T_MULT? 1: 0; } + static int (*prio)()=&prio_1; static long push(struct stack *s, long val) @@ -53,31 +55,22 @@ static long push(struct stack *s, long val) s->elt[s->last++]=val; return val; } + static long pop(struct stack *s) { return s->elt[--s->last]; } + static long top(struct stack *s) { return s->elt[s->last-1]; } + static long empty(struct stack *s) { return s->last==0; } -static void print() { - int i; - printf("NSTACK: "); - for (i=0; i