implement stack with some initial testing

This commit is contained in:
2025-11-29 12:57:07 +01:00
parent fe4c130d72
commit ef59987f08
4 changed files with 88 additions and 12 deletions
+7 -3
View File
@@ -1,13 +1,17 @@
#ifndef STACK_H
#define STACK_H
/* A stack is a special type of queue which uses the LIFO (last in, first out) principle.
This means that with each new element all other elements are pushed deeper into the stack.
/* A stack is a special type of queue which uses the LIFO (last in, first out) principle.
This means that with each new element all other elements are pushed deeper into the stack.
The latest element is taken from the stack. */
#include <stdlib.h>
//TODO: passenden Datentyp als struct anlegen
typedef struct StackNode
{
struct StackNode *next;
void *data;
} StackNode;
// Pushes data as pointer onto the stack.
StackNode *push(StackNode *stack, void *data);