Kommentare angepasst

This commit is contained in:
Rebekka Haemmerl 2025-12-11 15:47:51 +01:00
parent f249355a30
commit f513d63ebf

10
stack.c
View File

@ -1,12 +1,6 @@
#include <stdlib.h>
#include "stack.h"
//TODO: grundlegende Stackfunktionen implementieren:
/* * `push`: legt ein Element oben auf den Stack,
* `pop`: entfernt das oberste Element,
* `top`: liefert das oberste Element zurück,
* `clearStack`: gibt den gesamten Speicher frei. */
// Pushes data as pointer onto the stack.
StackNode *push(StackNode *stack, void *data)
{
@ -14,7 +8,7 @@ StackNode *push(StackNode *stack, void *data)
{
return stack; //Nichts pushen
}
//if(stack && data){
StackNode *t = (StackNode *)malloc(sizeof(StackNode));
if(!t)
{
@ -23,7 +17,7 @@ StackNode *push(StackNode *stack, void *data)
t->next = stack;
t->data = data;
return t; //Gibt den ersten StackNode des Stacks zurueck
//}
return NULL;
}