diff --git a/stack.c b/stack.c index d9e4013..e351223 100644 --- a/stack.c +++ b/stack.c @@ -31,16 +31,11 @@ StackNode *push(StackNode *stack, void *data) // freed by caller.) StackNode *pop(StackNode *stack) { - if(stack) - { - StackNode *t = stack->next; //Naechstes Element im Stack wird erstes Element - free(stack); - return t; - } - else + if(stack == NULL) { return NULL; } + return stack->next; } // Returns the data of the top element. diff --git a/test_stack.exe b/test_stack.exe new file mode 100644 index 0000000..ebcff7e Binary files /dev/null and b/test_stack.exe differ