diff --git a/stack.c b/stack.c index e3a90d4..8fb905f 100644 --- a/stack.c +++ b/stack.c @@ -10,6 +10,15 @@ // Pushes data as pointer onto the stack. StackNode *push(StackNode *stack, void *data) { + //Speicher reservieren + StackNode *newNode = malloc(sizeof(StackNode)); + if (!newNode) + return stack; + + newNode->data = data; + newNode->next = stack; + + return newNode; }