From 013653ff22eaf9e4a31207883e3752c4ea12bcb8 Mon Sep 17 00:00:00 2001
From: Orestis <orestis.malaspinas@pm.me>
Date: Tue, 23 Nov 2021 23:35:26 +0100
Subject: [PATCH] corrected slide 42,

---
 slides/cours_9.md | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/slides/cours_9.md b/slides/cours_9.md
index d46856b..4e83cd7 100644
--- a/slides/cours_9.md
+++ b/slides/cours_9.md
@@ -439,7 +439,8 @@ char *infix_to_postfix(char* infix) { // init and alloc stack and postfix
     for (size_t i = 0; i < strlen(infix); ++i) {
         if (is_operand(infix[i])) { 
             // we just add operands in the new postfix string
-        } else if (infix[i] == '(') { // we push opening parenthesis into the stack
+        } else if (infix[i] == '(') { 
+            // we push opening parenthesis into the stack
             stack_push(&s, infix[i]); 
         } else if (infix[i] == ')') { 
             // we pop everything into the postfix
@@ -537,8 +538,8 @@ typedef element* stack;
 stack stack_create(); // return NULL;
 void stack_destroy(stack *s);
 void stack_push(stack *s, int val);
-int stack_pop(stack *s);
-int stack_peek(stack s);
+void stack_pop(stack *s, int *val);
+void stack_peek(stack s, int *val);
 bool stack_is_empty(stack s); // reutrn NULL == stack;
 ```
 
@@ -592,8 +593,8 @@ void stack_push(stack *s, int val) {
 . . .
 
 ```C
-int stack_peek(stack s) {
-    return s->data;
+void stack_peek(stack s, int *val) {
+    *val = s->data;
 }
 ```
 
@@ -618,8 +619,8 @@ int stack_peek(stack s) {
 . . .
 
 ```C
-int stack_pop(stack *s) {
-    int val = stack_peek(*s);
+void stack_pop(stack *s, int *val) {
+    stack_peek(*s, val);
     element *tmp = *s;
     *s = (*s)->next;
     free(tmp);
-- 
GitLab